【发布时间】:2015-07-08 06:32:57
【问题描述】:
我想让我的 UIbarbuttonItem 带有圆角(右侧)。 I referred the link to implement 还是我没有得到。图片来自 URL。我的代码是,
dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData * data = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString:userImage]];
if ( data == nil )
return;
dispatch_async(dispatch_get_main_queue(), ^{
// WARNING: is the cell still using the same data by this point??
UIImage *img = [UIImage imageWithData: data];
UIImage *btnImage = [self imageWithImage:img scaledToSize:CGSizeMake(50, 50)];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
// btn.bounds = CGRectMake( 0, 0, btnImage.size.width, btnImage.size.height );
[btn addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchDown];
[btn setImage:btnImage forState:UIControlStateNormal];
UIBarButtonItem *btnItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
self.navigationItem.rightBarButtonItem = btnItem;
});
});
我需要实现与图像相同。我做错了什么,请任何人帮我解决这个问题。
【问题讨论】:
标签: objective-c uinavigationbar uibarbuttonitem uinavigationitem ios8.3