Tag: uitableview

通过tableview添加视图(UITableViewController)

情况:我有一个UITableViewController从一个服务asynchronous加载一些数据。 在此期间,我想放置一个全屏幕(除了导航栏)视图在表视图显示我的自定义指标和文字。 问题:我面临的问题是,当我的自定义视图(它有一个红色的背景)被放置在UITableView的表视图的行通过我的自定义视图(见下图)显示。 我尝试过:我试图使用insertBelow和以上,没有工作。 我也试过:tableview.Hidden = true,但是由于某些原因,这也隐藏了自定义视图,如图2所示。 Image1:出于某种原因,我可以看到线条抛出了我的视野。 图2:当隐藏=真使用时,Tableview +自定义视图消失。 我的代码: public override void ViewDidLoad () { base.ViewDidLoad (); UIView view = new UIView (new RectangleF (0, 0, this.TableView.Frame.Width, this.TableView.Frame.Height)); view.BackgroundColor = UIColor.Red; this.TableView.AddSubview (view); TableView.Source = new SessionTableViewSource (); }

允许在iOS中的UITextField单个数字

我有一个Verification ViewController ,我通过短信得到4位validation码,我需要input这些代码login,我已经创build了这样的ViewController 正如你可以看到四个UITextField ,我需要只允许每个UITextField单个数字, 我试过:我试图使用shouldChangeCharactersInRange:method: ,但它没有被调用,我不知道什么是错的,我想因为UITextField在UITableView所以它不工作。

我可以用一个UITableViewDelegate使用多个segues吗?

我有一个UITableView列出多种types的对象,我想继续不同的视图取决于用户select哪种types的对象。 有可能通过使用多个赛段来做到这一点,如果是这样,如何呢?

GCD UITableViewasynchronous加载图像,加载错误的单元格直到新图像下载

我有一个UITableView与自定义单元格。 我使用Grand Central Dispatchasynchronous加载图像。 一切工作正常,但是当我向下滚动,以前加载的图像显示,直到新的图像下载。 这是我的代码: if (![[NSFileManager defaultManager] fileExistsAtPath:[path stringByAppendingPathComponent:@"image.png"]]) { dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); dispatch_async(queue, ^{ NSString *url=[pat stringByAppendingPathComponent:@"comments.txt"]; NSString *u=[NSString stringWithContentsOfFile:url encoding:NSUTF8StringEncoding error:nil]; NSURL *imageURL=[NSURL URLWithString:u]; NSData *image=[NSData dataWithContentsOfURL:imageURL]; [image writeToFile:[pat stringByAppendingPathComponent:@"image.png"] atomically:YES]; dispatch_sync(dispatch_get_main_queue(), ^{ cell.imageView.image=[UIImage imageWithContentsOfFile:[pat stringByAppendingPathComponent:@"image.png"]]; [cell setNeedsLayout]; NSLog(@"Download"); }); }); } else { NSLog(@"cache"); cell.imageView.image=[UIImage imageWithContentsOfFile:[pat stringByAppendingPathComponent:@"image.png"]]; } […]

iOS 7.0和ARC:UITableView从未在行animation之后解除分配

我有一个非常简单的testing应用程序与ARC。 其中一个视图控制器包含UITableView。 在做animation之后( insertRowsAtIndexPaths或者deleteRowsAtIndexPaths ),UITableView(和所有的单元格)永远不会被释放。 如果我使用reloadData ,它工作正常。 iOS 6没有问题,只有iOS 7.0。 任何想法如何解决这个内存泄漏? -(void)expand { expanded = !expanded; NSArray* paths = [NSArray arrayWithObjects:[NSIndexPath indexPathForRow:0 inSection:0], [NSIndexPath indexPathForRow:1 inSection:0],nil]; if (expanded) { //[table_view reloadData]; [table_view insertRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationMiddle]; } else { //[table_view reloadData]; [table_view deleteRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationMiddle]; } } -(int)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return expanded ? 2 : 0; } […]

iOS 11search栏跳转到屏幕顶部

我有一个UITableView,我把它的标题设置为一个search栏。 tableView.tableHeaderView = searchController.searchBar 一切工作按计划,直到你点击它,它似乎从tableView分离并跳转到屏幕的顶部。 tableView行留在原地。 任何理由会在iOS 11而不是iOS 10中做到这一点?

错误:UITableView跳到UITableViewAutomaticDimension顶部

我正在使用UITableView与estimatedRowHeight和UITableViewAutomaticDimension 。 另外我正在使用NSFetchedResultsControllerDelegate来反映更改。 一切都很好。 现在的问题是,当我添加一些logging到CoreData , CoreData调用它的委托,但一个意想不到的事情发生。 每次TableView突然滚动到顶部。 NSFetchedResultsControllerDelegate func controllerWillChangeContent(controller: NSFetchedResultsController) { tableView.beginUpdates() } func controllerDidChangeContent(controller: NSFetchedResultsController) { tableView.endUpdates() } func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { switch type { case .Insert: tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .None) break case .Update: tableView.reloadRowsAtIndexPaths([indexPath!], withRowAnimation: .None) break case .Delete: tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: […]

是否有可能有一个固定的uitableview标题使用部分?

这个问题不应该混淆在这里。 。 这是两件不同的事情。 有一个很好的例子,如何在SO上使用UITableView头。 这一切都工作正常,主标题固定在顶部,只要风格设置为plain 。 但是,如果我使用sections ,主标题不再坚持顶部,并移动到底部滚动。 在这种方法中,我将返回每个部分的标题。 – (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 在这个方法中,我将上面的标题部分的高度设置为: – (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 在这个方法中,我设置了真正的表头。 – (void)viewWillAppear:(BOOL)animated { … self.recordTableView.tableHeaderView = headerView; } 甚至有可能有一个固定的表头,而使用部分? 什么是这个替代解决scheme?

使用Swift for iOS以编程方式创build和存储PDF文档

我有一个应用程序,可以查看已经存储在项目中的PDF。 我希望能够创build一个新的PDF文档,并将其存储在应用程序目录中,以便在现有的查看器中查看。 PDF将从数组var todoList: [String] = []显示在UITableView上创build。 我知道要创build一个PDF,我必须创build一个文件名,path和目录。 我不知道该怎么做 我看到了URL和URL请求的在线引用,但我不确定这是否是我想要的正确途径。 有人能给我一些build议和指导吗? 我能find的所有东西都是Objective-C。

为tableview(uitableview)绘制一个自定义单元格,更改颜色和分隔符的颜色和宽度

我想绘制具有分组样式的UITableViewCell的背景。 我的问题是我无法调用-(void)drawRect:(CGRect)rect或者我认为它应该以编程方式调用… 我已经从以下链接采取代码。 如何自定义分组表格视图单元格的背景/边框颜色? // // CustomCellBackgroundView.h // // Created by Mike Akers on 11/21/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> typedef enum { CustomCellBackgroundViewPositionTop, CustomCellBackgroundViewPositionMiddle, CustomCellBackgroundViewPositionBottom, CustomCellBackgroundViewPositionSingle } CustomCellBackgroundViewPosition; @interface CustomCellBackgroundView : UIView { UIColor *borderColor; UIColor *fillColor; CustomCellBackgroundViewPosition position; } @property(nonatomic, retain) UIColor *borderColor, *fillColor; @property(nonatomic) CustomCellBackgroundViewPosition position; @end […]