自定义导航栏上的button

来源:互联网 发布:淘宝店运费险怎么取消 编辑:程序博客网 时间:2024/05/21 19:09

UIButton * btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];

    btn1.frame = CGRectMake(0, 0, 30, 34);

    [btn1 addTarget:self action:@selector(navBtnPress:) forControlEvents:UIControlEventTouchUpInside];

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn1];


创建一个button ,然后用它去初始化UIBarButtonItem.

原创粉丝点击