UITableView和select项目
我目前正在创build一个简单的分组的UITableView,当用户select例如“苹果”,我想我的项目中的图像被加载到苹果的图像视图。
我在互联网上看到了一些例子,但我想看看还有什么。
任何build议将不胜感激。 谢谢。
或者设置cell.imageView.highlightedImage
,或者在didSelectRowAtIndexPath
方法中,将cell.imageView.image
从nil改为某些[UIImage imageNamed:@"myImage.png"]
:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *kCustomCellID = @"com.me.foo.cell"; UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCustomCellID] autorelease]; cell.textLabel.highlightedTextColor = [UIColor blueColor]; cell.imageView.image = nil; cell.imageView.highlightedImage = [UIImage imageNamed:@"myImage.png"]; return cell; } - (void)tableView:(UITableView *)tableView willDisplayCell:(iPadRootViewControllerTableCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { cell.imageView.contentMode = UIViewContentModeScaleAspectFit; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Do this if you didnt set the highlightedImage in cellForRowAtIndexPath // [self tableView:tableView cellForRowAtIndexPath:indexPath].imageView.image = [UIImage imageNamed:@"myApple.png"]; }
- 通过静默推送通知startUpdatingLocationManager
- iOS 10问题:即使设置了ContentSize,UIScrollView也不滚动
- 主线程上的IOS semaphore_wait_trap导致在UI中挂起
- iOS,无法识别的选择器发送到实例?
- 使用我的ios App iOS 9 Swift 2.2中的路线打开Apple Maps应用程序
- 将CKAsset保存到CloudKit中的CKRecord会产生错误:“没有收到资产的authToken”
- 从用户位置查找数组中最接近的经度和纬度 – iOS Swift
- 将应用程序部署到App Store后,Worklight 6.1“拒绝访问受保护的服务”
- 在下载iOS时stream式传输video