Guest User

Untitled

a guest
Jan 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. const CGRect imageFrame = CGRectMake(0, 0, 44., 44.);
  2. UIButton *button = [[UIButton alloc] initWithFrame:imageFrame];
  3.  
  4. [button setImage:[UIImage imageNamed:@"backButton"] forState:UIControlStateNormal];
  5.  
  6. [button setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
  7.  
  8. button.contentEdgeInsets = UIEdgeInsetsMake(0, -6., 0, 0); // здесь получается сдвинуть влево картинку на кнопке, но не саму кнопку
  9.  
  10. // [button addTarget:self action:someSelector forControlEvents:UIControlEventTouchUpInside];
  11.  
  12. UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  13.  
  14. [self.navigationItem setLeftBarButtonItem:backButton];
Add Comment
Please, Sign In to add comment