美文网首页iOS开发
用自定义控件设置导航栏的titleView

用自定义控件设置导航栏的titleView

作者: 悄然林静 | 来源:发表于2019-01-17 13:57 被阅读0次
    UIButton * button =[UIButton buttonWithType:UIButtonTypeCustom];
    button.frame=CGRectMake(20, 20, 100, 40);
    [button setTitle:@"1/3" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(showAllQuestions:) forControlEvents:UIControlEventTouchUpInside];
     
    self.navigationItem.titleView = button;
    

    相关文章

      网友评论

        本文标题:用自定义控件设置导航栏的titleView

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