我想对UITableViewCell的图像——电池.imageView.image(例如,Red <->Green)
如果目前的形象是绿色的,那么当用户点击UITableViewCell时,图像会变。
一俟我树立形象
cell.imageView.image = [UIImage imageNamed:@"Green.png"];
如何发现该囚室目前使用的是什么形象?
感谢任何帮助!
我想对UITableViewCell的图像——电池.imageView.image(例如,Red <->Green)
如果目前的形象是绿色的,那么当用户点击UITableViewCell时,图像会变。
一俟我树立形象
cell.imageView.image = [UIImage imageNamed:@"Green.png"];
如何发现该囚室目前使用的是什么形象?
感谢任何帮助!
这只是粗略的,但是,如果说这样的话,你就应该能够:
if ([cell.imageView.image isEqual:[UIImage imageNamed:@"Green.png"]]) {
// image is green;
} else {
// image is red;
}
我仅对它进行了测试,以确保它能够奏效。
#define IMAGE_TAG_GREEN 50
#define IMAGE_TAG_RED 51
-(UITableViewCell*) tableView:(UITableView*) tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath {
static NSString *CELL_ID = @"some_cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CELL_ID];
if(cell == nil) {
//do setup here...
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CELL_ID] autorelease];
cell.imageView.tag = //some logic here...
}
if(cell.imageView.tag == IMAGE_TAG_GREEN) {
//...
} else {
//...
}
return cell;
}
<>Sincetag
为。 www.un.org/chinese/ga/president 使用<代码>UIImageView
I believe just add a Boolean expression and make it TRUE if it is green and FALSE if it is red. Make this boolean expression extern type so that this could be a global expression. Set the boolean value on clicking the image. I believe this would be of some help.
我对这一点说了新话,但我想象,你会作一番话。
If (cell.imageView.image = [UIImage imageNamed:@"Green.png"]) {
cell.imageView.image = [UIImage imageNamed:@"Green.png"];
} else
{
cell.imageView.image = [UIImage imageNamed:@"Red.png"];
}
I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...
HI, In our application i am using corelocationframework when opening application a alert for allow and dont allow.when clicking on the allow for current location we will show current location.When ...
Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...
我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......
我希望我与四舍五入的累进角进行网上讨论。
我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
I like to write bash shell scripts on my iPhone, put them in an app folder with an icon, plist, etc., so they execute like apps by tapping their icon on SpringBoard. This is not interactive like ...