美文网首页
ios 11 导航条titleView问题处理

ios 11 导航条titleView问题处理

作者: Mrxiaowang | 来源:发表于2018-03-13 13:42 被阅读24次

一:自定义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。

相关文章

网友评论

      本文标题:ios 11 导航条titleView问题处理

      本文链接:https://www.haomeiwen.com/subject/gsnpfftx.html