IOS开展:导航中添加多个button并加入左侧logo

IOS开展:导航中添加多个button并加入左侧logo

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

添加多个button,同样只能加入一个
 UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"register", nil) style:UIBarButtonItemStylePlain target:self action:@selector(registerClick:)];            UIBarButtonItem *anotherButton2 = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"login", nil) style:UIBarButtonItemStylePlain target:self action:@selector(loginClick:)];            [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects: anotherButton,anotherButton2,nil]];

加入Logo,仅仅在第一个页面显示,用以下这种方法

self.shareNavleftView = [[UIView alloc] init];        self.shareNavleftView.frame = CGRectMake(0.0, 0.0, 191.0, 47.0);        UIImageView *img = [[UIImageView alloc] init];        img.image = [UIImage imageNamed:@"oatosLogo.png"];        img.autoresizingMask = UIViewAutoresizingFlexibleWidth;        img.frame = self.shareNavleftView.frame;        [self.shareNavleftView addSubview:img];        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.shareNavleftView];

用以下这种方法。则会把Logo加入到后面的每个页面。不符合我的需求

[self.navigationController.view addSubview:self.shareNavleftView];

版权声明:本文博主原创文章,博客,未经同意不得转载。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/116842.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号