我试图用 UIImage 设置右键项目:
它推动了我以编程方式创建的 UINavbar(它是 IBOutlet 并在情节提要中使用)左按钮和右按钮。左按钮工作得很好,而不是右按钮似乎没有被初始化。
在标题中:
@property (weak, nonatomic) IBOutlet UINavigationBar *navBar;
我尝试的是:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture", self.userDestFBID]];
NSData *imageData = [NSData dataWithContentsOfURL:url];
UIImage *destProfileImage = [UIImage imageWithData:imageData];
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithImage:_destProfileImage style:UIBarButtonItemStyleDone target:self action:@selector(goBack)];
_item = [[UINavigationItem alloc] initWithTitle:nil];
_item.hidesBackButton = YES;
_item.leftBarButtonItem = activityItem;
_item.rightBarButtonItem = rightButton;
[_navBar pushNavigationItem:_item animated:YES];
任何帮助将不胜感激 ..