Tag: 可用视图

刷新UITableView在第三个单元格后崩溃后滚动到顶部

在我的刷新方法,我使用下面的代码滚动到顶部工作正常,但是当我向下滚动第三个单元格后,再次点击刷新它崩溃的应用程序error terminating with uncaught exception of type NSException 。 [TableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES]; UITableView有7个dynamic单元格。 我需要添加一些东西,使其整个tableview的工作? 我在StackOverflow上search了一个解决scheme,但不幸的是他们没有解决我的问题。

从ios中的Plist嵌套展开式UITableView

嗨,是否有可能使用plist创build一个可扩展的表或ios视图? 这里是plist文件和控制types的意思 0 =开关 1 = TextField 我可以迭代plist创build一个可展开的表视图? 而输出应该是这个。 如果开关closures,则父项的所有子父项都将折叠。 我希望有一个人可以帮助我。 先谢谢了

奇怪的行为dynamicuitableviewcell高度

我试图使我的custome细胞dynamicuitableviewcell高度。 单元格被添加一些背景的子类。 这是我的uitableview控制器类: #define PADDING 23.0f – (void)viewDidLoad { [super viewDidLoad]; [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; } – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSUInteger count = [self.entries count]; return count + _rowcount; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *reuseIdentifier = @"PlaceholderCell2"; SubcategoryTableViewCell * sctvCell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier]; if (sctvCell == nil) { sctvCell= [[SubcategoryTableViewCell alloc] […]

自定义选中行的复选标记

我在“UITableViewCell”中使用自定义图像作为复选标记 – “iphone-checkMark@2x.png”,但它显示在单元格的任何位置。 任何人都可以build议如何使其仅显示单个选定的单元格? 这是我的代码: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10,10, 300, 30)]; [cell.contentView addSubview:label]; label.text = [tableArr objectAtIndex:indexPath.row]; label.font = [UIFont fontWithName:@"Whitney-Light" size:20.0]; label.tag = 1; UIImageView *checkmark = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iphone-checkMark@2x.png"]]; cell.accessoryView […]

固定在UITableview底部的一个浮动button与scrollViewDidScroll不能正常工作

我使用这段代码使UIButton在UITable的底部浮动,但最初UIButton会追加到UITableView的最后一个单元的下方,只有当我滚动页面的时候UIButton才会到达底部,一开始我会让button到底? 提前致谢! – (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGRect frame = self.chatButtonView.frame; frame.origin.y = scrollView.contentOffset.y + self.tableView.frame.size.height – self.chatButtonView.frame.size.height; self.chatButtonView.frame = frame; [self.view bringSubviewToFront:self.chatButtonView]; }

从谷歌访问结果放置API自动完成

我正在使用这种方法来获取build议,我需要在tableview中显示它们: – (void)placeAutocomplete:(NSString *)autoCompleteString { [self.autoCompleteSuggestionsList removeAllObjects]; GMSAutocompleteFilter *filter = [[GMSAutocompleteFilter alloc] init]; filter.type = kGMSPlacesAutocompleteTypeFilterCity; [_placesClient autocompleteQuery:(NSString *)autoCompleteString bounds:nil filter:filter callback:^(NSArray *results, NSError *error) { if (error != nil) { NSLog(@"Autocomplete error %@", [error localizedDescription]); return; } for (GMSAutocompletePrediction* result in results) { //NSLog(@"Result '%@' with placeID %@", result.attributedFullText.string, result.placeID); //NSRange autoCompleteRange = [result.attributedFullText.string […]

为什么在dealloc方法中将scrollview的委托设置为零?

我发现,当我滑动一个tableview然后我按下了button,项目崩溃,消息是:消息发送到释放实例。 所以我加- (void)dealloc { [self.tableView setDelegate:nil]; } – (void)dealloc { [self.tableView setDelegate:nil]; }到我的项目和崩溃不会再发生。 但是我仍然不明白为什么如果我不添加上面提到的代码,项目会崩溃。 代表被释放,我仍然发送消息给它? 任何人都可以教我这个。 以下是scrollview中的代码做滚动方法。 – (void)scrollViewDidScroll:(UIScrollView *)scrollView{ CGFloat y = scrollView.contentOffset.y; [self.navigationController.navigationBar lt_setBackgroundColor:GWPRGBColor(255, 255, 255, ((y-100)/100.0f))]; }

如何使数组中的每个string成为自己的UITableViewCell,每个string都在自己的部分中?

在我的viewDidLoad ,我设置了一系列的议程项目,例如: self.agendaTableArray = @[@"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"No events today!", @"Dinner with Rebekah", @"Soccer game", @"Denist […]

更改tableView单元格内的UILabel框架高度

我从远程URL得到我的UILabel文本,有时文本太短/太长,我需要适应我的框架大小文本高度。 我用xib实现了服装单元格。 这是我到目前为止所尝试的,这应该是有效的,但不工作的理由我不明白: cell.fbLastObject.text = [NSString stringWithFormat:@"%@",update.fbLastObject]; [cell.fbLastObject sizeToFit]; //Cell Size CGSize labelSize = [cell.fbLastObject.text sizeWithFont:cell.fbLastObject.font constrainedToSize:cell.fbLastObject.frame.size lineBreakMode:NSLineBreakByWordWrapping]; labelHeight = labelSize.height; cell.fbLastObject.frame = CGRectMake(0,0,300,labelHeight); 任何人有任何想法?

无法根据objective-c中标签的文本大小设置单元格大小

我正在尝试聊天应用程序。 聊天工作正常。 面对一些用户界面问题。 1.我正在使用自动布局标签。 所以根据邮件大小自动标签获取展开。 但是,我在UITableViewCell中有标签。 我无法dynamic计算行高。 我的代码: -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ CGSize textSize = {268, CGFLOAT_MAX}; CGSize size = [message sizeWithFont:[UIFont fontWithName:@"Helvetica Neue" size:14] constrainedToSize:textSize lineBreakMode:NSLineBreakByWordWrapping]; CGFloat height = size.height < 65 ? 65 : size.height; return height; } 我的标签子类代码 – (void)drawTextInRect:(CGRect)rect { self.textInsets = UIEdgeInsetsMake(5, 5, 5, 5); return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.textInsets)]; } […]