Tag: uitableview

UITableView缺less新的可见行NSInternalInconsistencyException的单元格

我一直在与我的应用程序得到这个问题,不知道出了什么问题。 致命exception:NSInternalInconsistencyException缺less新的可见行78的单元格 这是堆栈跟踪: Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x191bbefd8 __exceptionPreprocess 1 libobjc.A.dylib 0x190620538 objc_exception_throw 2 CoreFoundation 0x191bbeeac +[NSException raise:format:] 3 Foundation 0x192656710 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] 4 UIKit 0x198022b3c __46-[UITableView _updateWithItems:updateSupport:]_block_invoke.1049 5 UIKit 0x197d234b8 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] 6 UIKit 0x197d39bac +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] 7 UIKit 0x197ee8770 -[UITableView _updateWithItems:updateSupport:] 8 UIKit 0x197eccfbc -[UITableView _endCellAnimationsWithContext:] 9 MyApp 0x1000ed518 -[UICommentsTableViewController insertNewComment:atLocation:] (UICommentsTableViewController.m:1228) […]

我如何定制UITableViewCell编辑风格?

我如何定制UITableViewCell编辑风格? 编辑时,我想将左侧图标更改为checkbox。 将更改UITableViewCell.editingAccessoryView工作?

如何使UITableViewCells默认select编辑

在上面的屏幕截图中,我已经通过单击手动select了单元格,但是我希望默认情况下select所有单元格进行编辑。

使用UISearchBar时保留UITableView单元状态

我正在使用UISearchBar在UITableView单元格中search名称。 在UISearchBar中input字符时如何保留单元格状态? 我分配了cellForRowAtIndexPath的checkbox,并假设我做出了如下面截图所示的select。 现在,如果我开始search字母'S',checkbox状态是'unchecked',如下所示。 即使单元在search时被“过滤”,我如何保留checkBox状态。 我知道,每当我们在UISearchBar中input文本, cellForRowAtIndexPath被调用。 以下是我的cellForRowAtIndexPath方法。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //static NSString *cellId = @"CheckBoxedCell"; NSString *cellId = [NSString stringWithFormat:@"S%1dR%1d",indexPath.section,indexPath.row]; CheckBoxedCellClass *cell = (CheckBoxedCellClass *)[self.tableViewContact dequeueReusableCellWithIdentifier:cellId]; if(!cell) { NSArray *nib; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { nib = [[NSBundle mainBundle] loadNibNamed:@"CheckBoxedCellClass" owner:self options:nil]; } else if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { nib = [[NSBundle […]

一直滚动UITableView

我有这个代码链接到一个ViewController的button作为子视图的UITableView: -(IBAction)Action:(id)sender{ [tableView setContentSize:CGSizeMake(320, 1000)]; } 这使得tableView可以滚动到底部,这样我可以使用几个button,我编程添加到底部。 到现在为止还挺好。 但是,我希望tableView从一开始就好,所以我在viewDidLoad中添加了代码。 令人惊讶的是,它根本不起作用。 有人能帮我一下吗? 谢谢!

如何在iOS中search时获得选定的tableviewbutton值

如何在iOS中search时获得选定的tableviewbutton值 我有一个button在tableviewcell里面,在那个button,我检索json值并存储在它,但是当我点击那个button,我得到的button值正确。 但是,当我在tableview中search,然后单击该button,我会在iOS中得到一个错误的值。 view *destViewController = segue.destinationViewController; destViewController.manid = [[man objectAtIndex:[sender tag]]objectForKey:@"mgrid"]; 我正在使用这个来获得选定的button值 cell.invi.text = [[self.searchResults objectAtIndex:indexPath.row]objectForKey:@"mgrid"]; cell.invi.tag = indexPath.row; 这是我在cellForRowAtIndexPath标记。

如何在另一个选项卡中点击另一个button时更改button的图像

我有一个UITabBarController有3个选项卡(tab1,tab2,tab3)。 每个选项卡有一个UITableView,每个表视图在每一行都有一个button。 现在我想要用户点击tab2上的任何button,并且tab1中的button应该已经改变了图像。 我可以在tab1中获取button的标签,但是当点击tab2中的button时,我不知道如何获得tab1中button的标签。 我怎样才能做到这一点? 非常感谢。 这是我的代码在tab1中创buildtableview: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; UIButton *market= [UIButton buttonWithType:UIButtonTypeCustom]; [market setFrame:CGRectMake(200, 6, 30, 30)]; market.tag = 4000; [market addTarget:self action:@selector(marketPressedAction:) forControlEvents:UIControlEventTouchDown]; [cell.contentView addSubview:market]; UILabel […]

UITableviewcell内容更新反映到其他单元格

我在桌面视图中使用8个单元格。 每个单元格都有一组组件,如UIButton,UILabel和UISlider。 当我更新第六个单元格时,它反映到第一个单元格。 同样,如果我更新第七个单元格,它反映到第二个单元格。 删除单元格代码: { [buttonarray removeObjectAtIndex:delpath.row]; viewcount–; ListCell1 *cell=(ListCell1 *)[table cellForRowAtIndexPath:delpath]; cell.slider.value=0; cell.qlabel.text=@"1"; cell.slabel.text=@"1"; cell.n=1; [cell.button1 setTitle:@"240" forState:UIControlStateNormal]; for (int m=0; m<7; m++) { [[cell.myarray objectAtIndex:m]setImage:[UIImage imageNamed:@"Num2.png"] forState:UIControlStateNormal]; UIButton *but=[cell.myarray objectAtIndex:m]; but.tag=0; } [self->table deleteRowsAtIndexPaths:[NSArray arrayWithObjects:delpath, nil] withRowAnimation:UITableViewRowAnimationFade]; [table reloadData]; delpath=NULL; } 当按下button时 -(void)buttonpressed:(id)sender { viewcount++; table.delegate=self; table.dataSource=self; //UIView *middleview=[[UIView alloc]initWithFrame:CGRectMake(100,200,300,200)]; [buttonarray addObject:sender]; […]

部分中的行数

我有一个从plist填充的表视图。 在plist中我有一个Categories数组: Catgeories – Array item 0 – Maths item 1 – English …. 在同一个plist我有一个Notes数组 Notes – Array item 0 – Dictionary Title – My maths note 1 Text – This is algebra Category – Maths item 1 – Dictionary Title – My English Text – This is algebra Category – English 我有几个部分… – (NSInteger)numberOfSectionsInTableView:(UITableView […]

在IOS开发中的视图控制器之间共享对象状态

我的应用程序在主TabViewController上有两个选项卡。 第一个标签显示了我喜欢的水果清单。 第二个选项卡在您键入的同时向api发送请求,searchsearch名称的水果。 如果用户点击任何水果,我会显示一个水果细节视图,在那里可以喜欢水果(如果已经喜欢,你可以不同)。 现在,我试图达到这样的东西: 用户search一个水果 用户喜欢水果 用户导航回到列表 列表显示突出显示“喜欢”图标的水果 我怎样才能通知select行之前的列表,单元格状态的变化(这是不喜欢的,现在是喜欢的)。 我怎样才能通知其他列表(在另一个标签)相同的东西? 多谢你们 编辑 我会试着展示一个真实的样本! 当你去appstore并searchGMAIL 然后你去特色(图表,我不知道你的国家),并寻找同样的应用程序 当您在任何一个视图控制器中下载它时,同时另一个控制器显示相同的状态。 这正是我想要做的。