[英]iOS: I have an error message 'Address of property expression requested'
[英]Address of property expression requested
我通過引用另一個類傳遞我的UINavigationController。 但它顯示錯誤的屬性表達式請求的地址 。
MyUtil * util = [[[MyUtil alloc] init];
[util NavAndBackBtn:&self.navigationController]; //在這里給出錯誤。
MyUtil.m
-(void)NavAndBackBtn:(UINavigationController **)nav // ** for passing by reference
{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:@"icon_back.png"] forState:UIControlStateNormal];
[button setFrame:CGRectMake(0,0,36,20);
UIBarButtonItem *barbtn = [[UIBarButton alloc] initWithCustomView:btn];
//*nav.navigationController.navigationItem.leftBarButtonItem = barbtn;// this gives error
//then i set this nav to Util nav
self.main_nav_ofUtilClass = *nav;
sefl.main_nav_ofUtilClass.navigationItem.leftBarButtonItem =barbtn;
}
問題
我如何通過引用傳遞UINavigationController 。 這樣我在另一個類中對UINavigationController所做的任何更改都會發生在它上面。
我只想在另一個類名MyUtil中向UINavigationController添加后退按鈕圖像
我認為您在方法名稱上輸入了錯誤
-(void)NavAndBackBtn:(UINavigationController **)nav
使用這個
-(void)NavAndBackBtn:(UINavigationController *)nav
移除**
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.