【发布时间】:2015-12-25 17:27:37
【问题描述】:
我正在使用带有 uitableview 的自定义单元格。在单元格中,我有一个 uiimage 和一个标签。当我加载表格视图时,我在自定义单元格中加载所有未选择的图像。现在我想当用户当时选择一个单元格时想要更改图像(选定的图像)。之后它进入另一个视图控制器,但是当用户进来时,他可以看到带有选定图像图标的选定单元格。
- (void)viewDidLoad {
[super viewDidLoad];
title=[[NSArray alloc]initWithObjects:@"Hi one ", @"one ",@"one ACCOUNT ",@"one A SEVICE",@"one YOUR ORDER",@"one FREE SERVICE",@" one WALL",@"one POINTS", @"one LOCATOR",@"one WITH US",@"one_ PACKAGE",@"one_call",nil];
imgicon=[[NSArray alloc]initWithObjects:@"profile_icon.png",@"db_icon.png",@"ma_icon.png",@"pickup_icon.png",
@"ic_track_nav.9.png",@"rf_icon.png",@"wal_icon.png",@"ic_loylty_nav.9.png",@"ic__locator.9.png",@"ic_nification.png",@"kage_icon.png",@"ic_reachus.png",nil];
imgiconselected=[[NSArray alloc]initWithObjects:@"profile_icon.png",@"db_icon_p.png",@"ma_icon_p.png",@"pickup_icon_p.png",
@"ic_track_nav.9_p.png",@"rf_icon_p.png",@"wa_icon_p.png",@"ic_loya_nav.9_p.png",@"ic__locator.9_p.png",@"ic_notification_p.png",@"pge_icon_p.png",@"ic_reacs_p.png",nil];
[slidertb reloadData];
// Do any additional setup after loading the view.
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// here how can i get that cell path and icon image to change .
NSLog(@"row==%ld",(long)indexPath.row);
if(indexPath.row==1){
FroVC *froVC = [self.storyboard instantiateViewControllerWithIdentifier:@"froVC"];
UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
[navController setViewControllers: @[froVC] animated: NO ];
[self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];
}
}
【问题讨论】:
-
你为什么不使用
UIButton它有不同的状态,根据你可以改变图像 -
你能探索一下吗?我没有得到你
标签: ios objective-c uitableview uiimageview