ios 11 导航条titleView问题处理

一:自定义titleHeadView  ,

titleHeadView.h中:

@property(nonatomic, assign) CGSize intrinsicContentSize;

headView = [[titleHeadView alloc]init];

    headView.intrinsicContentSize = CGSizeMake(Screen_Width-100, 28);

    headView.translatesAutoresizingMaskIntoConstraints = false;

    headView.backgroundColor = [UIColor clearColor];

    searchtextFiled = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, Screen_Width-100, 28)];

    searchtextFiled.placeholder = @"请输入搜索关键字";

    searchtextFiled.clearButtonMode = UITextFieldViewModeWhileEditing;

    searchtextFiled.textColor =  [UIColor colorWithHexString:@"969696"];

    searchtextFiled.font = [UIFont systemFontOfSize:13];

    searchtextFiled.borderStyle = UITextBorderStyleRoundedRect;

    searchtextFiled.backgroundColor = [UIColor whiteColor];

    searchtextFiled.returnKeyType = UIReturnKeySearch;

    searchtextFiled.delegate = self;

    [headView addSubview:searchtextFiled];

    self.navigationItem.titleView = headView;

看不明白的可以加我主页的QQ。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容