Tag: 可用视图

为每个UITableViewCellpipe理倒数计时器

我必须为每个UITableViewCellpipe理倒数计时器。 随着时间的过去,必须删除那个cell 。 我已经开始实施,但坚持如何删除时间完成的特定cell 。 我的应用程序有多行,但为了演示的目的,我只显示了三行。 我的方法是:在TableViewController.m #import "TableViewController.h" #import "CountdownTimer.h" @interface TableViewController () <CountdownTimerDelegate> @property (nonatomic, strong) NSArray *demoList; @end @implementation TableViewController – (void)viewDidLoad { [super viewDidLoad]; self.demoList = [self dataSource]; } – (NSArray *)dataSource { NSDictionary *demoOne = @{@"DemoId": [NSNumber numberWithInt:1], @"DemoName": @"Timer One", @"DueDate": [[NSDate date] dateByAddingTimeInterval:60]}; NSDictionary *demoTwo = @{@"DemoId": [NSNumber […]

UITableViewCell更改selectedBackgroundView alpha?

我需要更改UITableViewCell的selectedBackgroundView的alpha。 所以我做了以下几点: UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.selectionStyle = UITableViewCellSelectionStyleBlue; UIView *bgView = [UIView new]; bgView.backgroundColor = [UIColor redColor]; bgView.alpha = 0.5;//This setting has no effect cell.selectedBackgroundView = bgView; } 以红色select单元格,但alpha设置对bgView没有影响。

如何隐藏一个静态的UITableViewCell?

你如何隐藏一个静态单元格? 我想隐藏和静态单元格,如果图像不存在。 我试过了: imageCell.hidden = YES; //did not work 我已经看到了答案,build议改变数据源或使用: – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 0;// will hide all cell } 但我无法find一个方法来做一个特定的视图单元格。 我想实现的是: if(image==nil){ //hide imageCell } 现在这里是捕获,图像被asynchronous下载,因此可能会在尝试downlaod之前调用deleguate方法。

如何从故事板返回自定义单元格高度?

早些时候,我问了一个关于如何隐藏静态单元格的问题 。 我得到的最好的答案隐藏单元格,但它然后将其他单元格高度设置为44 。 我想find一个方法来返回故事板提供的高度,因为不同的单元格可以有不同的高度。 也我的表视图分组,静态,和许多部分,如果这有助于使其更清晰。 我试过这个 – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 5 && image==nil && [indexPath section] == 1){ NSLog(@"hide cvell"); return 0; } return tableView.rowHeight; } 它似乎像return tableView.rowHeight; 还会返回44,所以没有变化:( 把它缩短,这是我需要帮助的; – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 5 && image==nil && [indexPath section] == 1){ NSLog(@"hide cvell"); […]

UITableView点击一个项目打开一个新的屏幕/视图/活动

我有一个表视图(HomeViewController)组成的项目为: 地点 报告 设置 我有这些项目作为单独的文件(LocationViewController,ReportingView控制器和设置ViewController)。现在,如果用户点击位置一个新的屏幕/活动/视图应该打开和rest项目相同。 可以有人请help.my代码是: #import "HomePageController.h" @implementation HomePageController @synthesize menuList, table; // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. – (void)viewDidLoad { menuList=[[NSMutableArray alloc] initWithObjects: [NSArray arrayWithObjects:@"LOCATIONS",nil], [NSArray arrayWithObjects:@"REPORTING",nil], [NSArray arrayWithObjects:@"SETTINGS",nil], [NSArray arrayWithObjects:@"PASSWORD",nil], [NSArray arrayWithObjects:@"HELP",nil], [NSArray arrayWithObjects:@"ABOUT",nil], [NSArray arrayWithObjects:@"SHARE",nil], nil]; [self.navigationController setNavigationBarHidden:NO]; self.navigationController.navigationBar.tintColor=[UIColor blackColor]; self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent; self.title=@"CoinRead"; […]

IOS 7如何使用UITableView的scrollToRowAtIndexPath

我是新来的IOS 7,我做了一个testing应用程序,当我想要使用scrollToRowAtIndexPath检测到左侧滑动。 滑动被检测到,但我正在努力与“自我”的定义。 我得到错误没有可见@interface为'SimpleTableViewController' – (void)handleSwipeLeft:(UISwipeGestureRecognizer *)recognizer { NSLog(@"%u = %d", recognizer.direction,recognizer.state); // jump to section 0 row 20 when leftswipe is dectected NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:20 inSection:0]; [self.tableView scrollToRowAtIndexPath:newIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO]; } 我可以发送完整的源代码,如果你想或者你可以在这里下载: www.auditext.com/xintax/SimpleTable.zip 使用self.tableView给消息Property'tableView'找不到'SimpleTableViewController'types的对象 – 它现在工作,我已经把这行添加到我的viewcontroller.h:@属性(强,非primefaces)IBOutlet UITableView * myview; NSIndexPath * loc = [NSIndexPath indexPathForRow:row inSection:section]; [self.myview scrollToRowAtIndexPath:loc atScrollPosition:UITableViewScrollPositionBottom animated:YES]; `

如何select另一个表行时将自定义图标删除到UITableViewCellAccessoryCheckmark

我正在使用以下代码将自定义图标添加到UITableViewCellAccessoryCheckmark。 问题在于单元格复选标记不会在另一行被触摸/select时取消select 这是我的代码: – (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { int index = indexPath.row; id obj = [listOfItems objectAtIndex:index]; //This toggles the checkmark UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; if (cell.accessoryType == UITableViewCellAccessoryNone) { cell.accessoryType = UITableViewCellAccessoryCheckmark; UIImage *image = [UIImage imageNamed:@"icon-tick.png"]; UIButton *downloadButton = [UIButton buttonWithType:UIButtonTypeCustom]; [downloadButton setImage:image forState:UIControlStateNormal]; [downloadButton setFrame:CGRectMake(0, 0, 19, 19)]; [downloadButton setBackgroundColor:[UIColor […]

保存date和价值的正确结构

我正在尝试保存用户信息并将其显示到UITableViewCell中,如下所示: (date) – (价值) 喜欢: (12/12/2014) – (240磅) 我不确定使用什么结构types。 我需要保存2个不同的对象(上面描述的nsdate和nstring值),并能够通过键(date和值)遍历它们,以显示uitableview中每个对象的文本。

select一个UITableViewCell滚动后select另一个单元格

即使这是常见的问题,但我没有得到如何解决这个问题。 我提到select一个UITableViewCell时select其他单元格在相同的位置,当你向上或向下滚动但我不明白。 我有allMumbaiArray (在cellForRowAtIndexPath中使用)和tableview alllMumbaiTableview 。 通过使用下面的代码,我可以select和取消select该行。 根据EI上尉的解决scheme更新 @property (nonatomic, strong) NSMutableArray *arrIndexpaths; tableView方法 – : – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CellIdentifier"]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"CellIdentifier"]; } cell.textLabel.text = [allMumbaiArray objectAtIndex:indexPath.row]; if ([self.arrIndexpaths containsObject:[NSNumber numberWithInt:indexPath.row]]) { cell.accessoryType = UITableViewCellAccessoryCheckmark; } else{ cell.accessoryType […]

更改自定义tableViewCell的背景颜色

我想改变我的细胞的背景颜色 我看到其他问题,但他们不符合我的情况 我想做一个通知tableView 例如,如果用户已经读取单元格,单元格的背景颜色将变为白色 如果不是,颜色是黄色的 开始时 我设置了颜色 -(void)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{ if(read[[indexPath row]]) [cell.backView setBckgroundColor:[UIColor whiteColor]; else [cell.backView setBckgroundColor:[UIColor redColor]; } 它的工作原理,然后我想改变颜色 tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath{ read[[indexPath row]] = yes; [cell.backView setBckgroundColor:[UIColor whiteColor]; cell.name.text = @"test"; } 它也可以 但是,如果我select其他细胞,它改变为原始的颜色 看来只能同时改变一个单元格的颜色 不pipe我用 cell.backgroundColor cell.contentView.backgroundColor cell.backView 它得到了同样的结果,任何人都可以帮助我 编辑4/20 20:13 我设置了阅读 tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath 抱歉误导,我更新代码 和我select其他单元格后,我不调用[tableView重载] 所以我不认为这是原因 顺便说一下,一切(如标签)可以改变,但背景颜色 如果我select单元格,则通过导航跳转到其他屏幕 答 结论第一 tableView: cellForRowAtIndexPath: […]