在AppDelegate中設置酒吧色調:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIColor *barColor = [UIColor colorWithRed:0 green:172/255.0 blue:193/255.0 alpha:1.0];
[[UINavigationBar appearance]setBarTintColor: barColor];
return YES;
}
現在,在您的視圖控制器:
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(0,0,80,30);
[btn addTarget:self action:@selector(signUpButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
UIColor *barColor = [UIColor colorWithRed:0 green:172/255.0 blue:193/255.0 alpha:1.0];
[btn setTitle:@"Call Me" forState:UIControlStateNormal];
[btn setTitleColor:barColor forState:UIControlStateNormal];
btn.backgroundColor = [UIColor lightGrayColor];
UIBarButtonItem *callBtn =[[UIBarButtonItem alloc]initWithCustomView:btn];
self.navigationItem.rightBarButtonItem = callBtn;
我需要設置左欄按鈕項目。並且我正在更新imagview – user5513630
錯誤'initwithfram:imageview.bound'錯誤,使用button.bound –
不要複製粘貼,根據需要調整它,還可能需要設置色調,背景和前景色,快樂編碼:) –