閱讀736 返回首頁    go 阿裏雲 go 技術社區[雲棲]


IOS中導航的返回按鈕定製

- (void)addBackItemWithAction:(SEL)action {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 80, 44)];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, 64, 44);
    [button setImage:[UIImage imageNamed:@"ic_back_nor"] forState:UIControlStateNormal];
    [button setTitle:@"返回" forState:UIControlStateNormal];
    [button setImageEdgeInsets:UIEdgeInsetsMake(0, -13, 0, 13)];
    [view addSubview:button];
    UILabel *label = [HYBControlMaker labelWithFrame:CGRectMake(10, 0, 34, 44) text:@"返回" textColor:[UIColor whiteColor] font:[UIFont boldSystemFontOfSize:15]];
    [view addSubview:label];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:view];
    return;
}

最後更新:2017-04-03 08:26:19

  上一篇:go XML(4)——schema文件相互引用
  下一篇:go 有意思的遊戲:Google XSS Game