美文网首页
返回按钮问题

返回按钮问题

作者: _bab | 来源:发表于2017-12-13 15:48 被阅读6次

    iOS11向左移动的办法

    if (isIOS11) {
    UIView *leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 44, 44)];
    leftView.extendRegionType = ClickExtendRegion;
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(-15, 0, 30, 44)];
    [btn setImage:[UIImage imageNamed:@"uikit_navigator_back_btn_normal"] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:@"uikit_navigator_back_btn_pressed"] forState:UIControlStateHighlighted];
    [btn addTarget:self action:@selector(clickBackButton) forControlEvents:UIControlEventTouchUpInside];
    [btn sizeToFit];
    [leftView addSubview:btn];
    _backButton = [[UIBarButtonItem alloc] initWithCustomView:leftView];
    [self.navigationItem setLeftBarButtonItem:self.backButton];

        } 

    相关文章

      网友评论

          本文标题:返回按钮问题

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