Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Allocate memory for the UIAlertView
  2. UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Slider Value" message:@" " delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
  3.  
  4. //Allocate memory for the UISlider
  5. UISlider myslider = [[UISlider alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
  6.  
  7. //Add a callback for what function should run when the slider changes values
  8. [myslider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
  9.        
  10. myslider.minimumValue = 0.0;
  11. myslider.maximumValue = 100.00;
  12. myslider.value = 75;
  13.  
  14. //Allocate memory for the UILabel
  15. UILabel expirationLabel = [[UILabel alloc] initWithFrame:CGRectMake(115.0, 60.0, 260.0, 25.0)];
  16. expirationLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(10.0)];
  17. expirationLabel.textColor = [UIColor whiteColor];
  18. expirationLabel.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
  19. expirationLabel.text = @"Heres my text";
  20.  
  21. //Add the slider to the Alert      
  22. [myAlertView addSubview:myslider];
  23. //Add the label to the Alert
  24. [myAlertView addSubview:expirationLabel];
  25. //show the alert
  26. [myAlertView show];
  27. [myAlertView release];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement