IOS 开发知识整理

2019-10-21  本文已影响0人  satisfying

1.IOS 滚动条滚动后顶部出现白条

  _scrollview.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;

2.自定义View中UITextField 不能获取焦点以及输入

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
    return YES;
}

3.uitableview 没数据的不显示分割线

self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];

4.从button的点击事件获取button title

-(void)click:(id)sender{
    UIButton *button = (UIButton *)sender;//参数id是一个通用内型,此处将其强制转换成UIButton内型
    NSString *mesage = [button currentTitle];//取得button title
    NSLog(@"%@",mesage);
}

5.NSArrary倒叙

//1.原始数组
NSMutableArray *array = [NSMutableArray arrayWithObjects:@"1",@"2",@"3",nil];
//2.倒序的数组
NSArray* reversedArray = [[array reverseObjectEnumerator] allObjects];

6.UITableView去掉分割线

 _tableView.separatorStyle = UITableViewCellSelectionStyleNone;

6.UITableView 设置分割线左右间距

[self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 45, 0, 0)];

7.用宏创建UILable

#define createLable(title,color,font)\
({\
    UILabel *lable=[UILabel new];\
    [lable setTextColor:color];\
    [lable setText:title];\
    [lable setFont:font];\
    (lable);\
})\

8.block 作为属性

@property(nonatomic,strong)void(^blockName)(NSString*enterprise);

9.UITableView UITableViewStyleGrouped 顶部间隔处理

  _tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
  1. UITableView UITableViewStyleGrouped section 分割线隐藏
  _tableView.separatorColor = _tableView.backgroundColor;
上一篇 下一篇

猜你喜欢

热点阅读