Tag: 可用视图

滚动时在UITableViewCells中滑动

我有一个UITableView并想要animation行将再次出现。 我也想切换animation,一些单元格应该得到UITableViewRowAnimationLeft和其他的UITableViewRowAnimationRight 。 但我不知道如何用我的UITableViewController实现这个function。 我试图插入以下代码行到cellForRowAtIndexPath : [self.tableView beginUpdates]; NSArray *updatePath = [NSArray arrayWithObject:indexPath]; [self.tableView reloadRowsAtIndexPaths:updatePath withRowAnimation:UITableViewRowAnimationLeft]; [self.tableView endUpdates]; 而不是在细胞中滑动,细胞的顺序改变或者其中一些出现两次。 我也尝试在创build单元格后插入这些行。 if (cell == nil) { … } else { [self.tableView beginUpdates]; NSArray *updatePath = [NSArray arrayWithObject:indexPath]; [self.tableView reloadRowsAtIndexPaths:updatePath withRowAnimation:UITableViewRowAnimationLeft]; [self.tableView endUpdates];

静态UITableViewCell在viewWillAppear中更改不会反映在显示中

我正在使用故事板中configuration的一些静态UITableViewCell来显示一些设置信息。 如果其他设置之一被closures,其他一些单元格应该被禁用。 为了使单元格进入适当的状态,在viewWillAppear我从NSUserDefaults读取设置,然后相应地更改单元格。 – (void) viewWillAppear:(BOOL)animated if ([[NSUserDefaults standardUserDefaults] boolForKey:@"OtherCellEnabled"]) { [self otherCell].alpha = 1.0; [self otherCell].userInteractionEnabled = YES; } else { NSLog(@"Changing alpha to 0.3"); [self otherCell].alpha = 0.3; [self otherCell].userInteractionEnabled = NO; } 问题是,当我真的运行该程序,即使它在日志中说,阿尔法改变,阿尔法实际上并没有改变。 userInteractionEnabled似乎坚持,但alpha保持在1.0。 这不是一个单元重用的问题,或者单元没有及时实例化,因为其他设置可以很好地改变。 将其从cell.alpha更改为cell.contentView.alpha的作品,但这是一个不同的设置。 似乎所有的设置“坚持”,除了alpha设置,这在某种程度上被覆盖。

更改单元格的圆angular半径insie分组的UITableView

经过几个小时的search,我想知道是否有可能改变grouped UITableView的angular落半径。 我试过了 hoursTable.layer.cornerRadius = 5.0; 但似乎没有任何改变。

自定义的UItableView不能正确显示在ios8上

我做了一个自定义的UITableViewCell ,当我显示它时,我有这个结果(我在iPhone 5上运行xcode 6和iOS 8 beta 1) http://imgur.com/2MyT0mF,Nx1o4bl#0 而当我旋转我的设备,然后旋转到肖像,一切都变得正确。 http://imgur.com/2MyT0mF,Nx1o4bl#1 请注意,当我使用xcode 5编译我的应用程序时,我没有任何问题。 cellForRowAtIndexPath:使用的代码cellForRowAtIndexPath: BGTCoursCell1 *cell = (BGTCoursCell1 *)[tableView dequeueReusableCellWithIdentifier:@"Cell"]; NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"BGTCoursCell1" owner:self options:nil]; cell = [nib objectAtIndex:0]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"HH:mm"]; NSLocale *locale = [NSLocale currentLocale]; [dateFormatter setLocale:locale]; if (indexPath.section == 0) { BGTCours *cours = [[currentDay […]

UITableView -headerViewForSection返回(null)

我有2个部分的UITableView 。 每个都有自己的headerView 。 我通过-viewForHeaderInSection:方法创build了一个自定义的headerView 。 后来,我打算修改一下,所以我需要使用viewForHeader方法,但我无法访问headerView和它的子subViews 。 作为一个简单的例子,我试图在viewForHeader中NSLog viewForHeader对象-didSelectRowAtIndexPath:但是我得到一个(null)结果。 示例代码: -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 75; } -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *myHeader = [[UIView alloc] init]; switch (section) { case 0: [myHeader setBackgroundColor:[UIColor greenColor]]; break; case 1: [myHeader setBackgroundColor:[UIColor redColor]]; break; default: break; } UILabel *myLabel = [[UILabel alloc] init]; [myLabel setFrame:CGRectMake(10, […]

如何在CNN应用程序中像在UITableView上展开图像

我的iPhone上有CNN应用程序 。 如果你打开它会显示“顶级故事”,并始终在桌面上的图片。 当我们向下滑动手指时,它将放大/缩小图像。 当我们向上滑动手指以显示更多的行时,它不会以相同的速度向上移动图像,而是使用表格行,而不是使表格行比离开屏幕的图片更快。 你知道如何做到这一点?

iOS表视图滞后问题,我使用调度和保存caching

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TableViewCell" forIndexPath:indexPath]; cell.tag = indexPath.row; //cell.imageView.image = nil; // Rounded Rect for cell image CALayer *cellImageLayer = cell.imageView.layer; [cellImageLayer setCornerRadius:25]; [cellImageLayer setMasksToBounds:YES]; [self getImages]; [self storeImages]; UIImage *image =_ResimSonHali[indexPath.row]; dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0); dispatch_async(queue, ^(void) { if (image) { dispatch_async(dispatch_get_main_queue(), ^{ if (cell.tag […]

如何在tableview中获取节标题的绝对位置?

如何在tableview中获取节标题的绝对位置? 我已经使用tableView:viewForHeaderInSection:获取标题的视图。但是现在我需要在屏幕上获得这个视图的绝对位置。 返回值的框架不是在屏幕上的绝对位置。我也试图调用superview,但它似乎不工作。

如何计算UILabel行中有多less个字符?

我想用单元格的dynamic高度制作一个UITableview 。 在每个单元格中,我正在显示不同文本的消息。 现在我想要我的表格单元格根据消息的文本,并且我单元格上的单元格应显示文本。 我正在使我的表格单元格可以容纳一行字符的数量的基础上灵活。 但是这是问题。 不同的字母需要不同的空间。 所以,我无法计算一行中可以有多less个字母。 对此有何build议?

iOS 8 UITableViewRowAction:向左滑动,图像?

我刚刚在iOS8上遇到了这个新的API。 我不能find任何解决scheme,如果有可能使用图像,而不是文本,并允许左右滑动? 这甚至有可能吗? 我发现的唯一的实现是这样的: – (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Button1" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){ // maybe show an action sheet with more options [self.tableView setEditing:NO]; }]; moreAction.backgroundColor = [UIColor blueColor]; UITableViewRowAction *moreAction2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Button2" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){ [self.tableView setEditing:NO]; }]; moreAction2.backgroundColor = [UIColor blueColor]; UITableViewRowAction […]