Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. -(void)showIndexPath:(NSIndexPath*)indexPath inView:(UIView*)view{
  2.  
  3. UILabel *lbl = [[UILabel alloc] init];
  4. lbl.text = [NSString stringWithFormat:@"%ld-%ld", (NSUInteger)indexPath.section, (NSUInteger)indexPath.item];
  5. lbl.font = [UIFont systemFontOfSize:8.f];
  6. lbl.numberOfLines = 0;
  7.  
  8. lbl.backgroundColor = [UIColor blackColor];
  9. lbl.textColor = [UIColor whiteColor];
  10.  
  11. [lbl sizeToFit];
  12.  
  13. [view addSubview:lbl];
  14.  
  15. NSMutableArray *constraints = [NSMutableArray array];
  16.  
  17. [constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[lbl(10)]" options:NSLayoutFormatAlignAllLeft metrics:nil views:@{@"lbl":lbl}]];
  18. [constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[lbl(10)]-|" options:NSLayoutFormatAlignAllLeft metrics:nil views:@{@"lbl":lbl}]];
  19.  
  20. [NSLayoutConstraint activateConstraints:constraints];
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement