Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. - (void)viewDidLoad
  2. {
  3. [super viewDidLoad];
  4.  
  5. self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
  6. self.searchBar.placeholder = @"placeholder doesn't work in 7.1";
  7. [self.view addSubview:self.searchBar];
  8.  
  9. self.button = [[UIButton alloc] initWithFrame:CGRectMake(0.0, 44.0, 100.0, 44.0)];
  10. self.button.backgroundColor = [UIColor redColor];
  11. [self.button setTitle:@"print text" forState:UIControlStateNormal];
  12. [self.button addTarget:self action:@selector(printSearchText) forControlEvents:UIControlEventTouchUpInside];
  13. [self.view addSubview:self.button];
  14. }
  15.  
  16. - (void)printSearchText
  17. {
  18. NSLog(@"print nil here: %@", self.searchBar.text);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement