Tag: uitableview

为什么披露指标不显示?

当应用程序运行在模拟器披露指标不显示。因此,我不能去详细 NamesTableViewController.m: #import "NamesTableViewController.h" @interface NamesTableViewController () @property (nonatomic, copy) NSDictionary *propertyList; @property (nonatomic, copy) NSArray *letters; @property (nonatomic, copy)NSMutableArray *filteredNames; @property (nonatomic, strong)UISearchController *searchController; @end @implementation NamesTableViewController @synthesize propertyList, letters, filteredNames, searchController; – (void)viewDidLoad { [super viewDidLoad]; UITableView *tableView = (id)[self.view viewWithTag:1]; [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; filteredNames = [[NSMutableArray alloc]init]; searchController = [[UISearchController alloc]init]; […]

用于添加图像和滚动图标到表格视图的逻辑

我有一个表格视图,并且我将四个UIImageView添加到一行,所以总共有五行和二十个图像视图。 我将图像逐一插入到单元格中。 一旦所有四个图像视图被填充,第二行将开始填充。 我需要一些逻辑。 我的意思是,我怎样才能检查哪个地方是下一个被填写在表视图和在哪个事件? 如何将图像逐个添加到UIImageView ? 另外,最初只显示两行。 填充这两行后,当图像开始进入第三行时,我需要在屏幕上的最后一行旁边显示一个图标,告诉用户下面有更多的数据。 另外,是否有任何事件来检测哪一行是当前屏幕上的最后一行? 还有什么办法可以单独从一行中select图像?

在部分中使用的对象的唯一值

我有一个类,我需要得到stream派对象,放入一个数组,获得唯一值(因为我会有很多),并使用该数组填充tableView的部分。 我有以下代码: class Movie { var name: String! var plot: String! var imageUrl: String! var genre: String! init(name: String, plot: String, img: String, genre: String) { self.name = name self.plot = plot self.imageUrl = img self.genre = genre } } } import UIKit class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var tableView: UITableView! override […]

UITableViewCell变得没有反应

我有一个popover屏幕,里面有: 一个标签,可能会或可能不会出现(标题) 一个search栏,可能会或可能不会出现 一个标签,可能会或可能不会出现,并有一个可变的高度(帮助标签) 一个可能或不可能出现的滚动视图,并且具有可变的高度(关于下表的一些信息) 一张桌子视图 为了呈现一些不错的东西,在viewDidLoad ,我移动了各种框架来正确放置对象,并且没有未使用的空间混乱我的popup窗口。 此外,我然后调整表(以获得最需要的地方),并通过contentSizeInPopover (避免有一个近乎空的巨大popover popover)的popup窗口。 所有resize似乎很好,但我有一个大问题:所有resize,我的UITableView的一些单元格变得没有响应。 一个或两个单元格,通常是第二个单元格,只有当我点击它们的外angular时才会作出响应,但是单元格的其余部分完全忽略了任何触摸。 我已经尝试了一切:移动所有viewWillAppear ,让autoresize做它的工作(似乎也不工作),但我仍然每次都有这个问题。 我发现,如果我评论涉及到更改表格frame或contentSizeInPopover中的问题,这个问题就会停止,但是我的视图被搞砸了,所以这不是一个修复。 如果有人能给我一些东西摆脱这个混乱,那将是非常棒的。 – (CGFloat)getHeightWithoutTable { (self.errorScrollView.hidden?0:self.errorScrollView。 frame.size.height + LIST_STD_SPACE); } – (void)viewDidLoad { [super viewDidLoad]; self.tableViewOutlet.backgroundView = nil; self.originData = [NSMutableArray array]; self.searchedData = [NSMutableArray array]; if(self.helper!= nil){ CGFloat heightOffset = 0; //内容 self.originData = [self.helper getData]; self.tableData = [NSMutableArray […]

在UITableViewCell中以静态UITableView编程添加控件

我有一个静态的UITableView ,我通过cellForRowAtIndexPath方法中的NSDictionary填充。 NSString *key = [sectionKeys objectAtIndex:[indexPath section]]; NSArray *contents = [sectionContents objectForKey:key]; NSString *contentForThisRow = [contents objectAtIndex:[indexPath row]]; static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } [[cell textLabel] setText:contentForThisRow]; 认为运作良好,我也需要添加控件到tableviewcells和每个单元格有不同的控制。 当我以编程方式将UITextField添加到单元格1,运行后的视图是好的5个部分,但是当我滚动我的tableview进一步下来时,第6节的单元格也获得一个UITextField控件。 UIDatePicker也一样,我的tableview的前5个部分都很好,但在滚动tableview的时候,最后两部分也得到了UIDatePicker控件。 注意:我在表格视图中有九个部分,每个部分都有一个单元格,但前两个部分包含两个单元格。

在数组块枚举中创buildUITableViews会导致崩溃

所以故事就这样:) 我试图阻止枚举NSArray中的对象,并dynamic创build每个UITableViews并将其添加到UIScrollView中。 为了可读性和可重用性,我使用www.objc.io中的Lighter View Controller 。 dataSource被分别为每个UITableView创build。 问题是我一直崩溃 -[NSObject(NSObject) doesNotRecognizeSelector:] 我从堆栈上的post中发现,块枚举中的对象由于速度问题而保留较弱,并且可以确认dataSource实际上是为每个表取消分配的。 我甚至试图用__strong初始化ArrayDataSource,但是没有任何效果。 __strong ArrayDataSource *customdayTableDataSource = [[ArrayDataSource alloc] initWithConfigureCellBlock:configureCell cellIdentifier:DayTableCellIdentifier]; 我在做什么错在块? 你能指点我正确的方向吗? TableViewCellConfigureBlock configureCell = ^(id cell, id object) { [cell configureForObject:object]; }; [NSArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { int tableHorizontalPosition = [[UIScreen mainScreen] bounds].size.width * idx; int tableHeight = [[UIScreen mainScreen] bounds].size.height; […]

在新的UIView中获取点击UITableViewCell的对象?

从UITableViewCell中的单元格向新的视图传递参数数据的正确方法是什么? 我从我的UITableViewCell中的原型单元格中指定了一个segue,它将它链接到一个新的UIVIew并设置为show (aka push) 。 新的UIView显示,但我不知道如何告诉UIView选定的部分/行或告诉它关于与该select相关联的对象。 我的代码的删节版本如下所示: class MyTableViewController : UITableViewController { // other code omitted override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { let files = filesByDate[filesByDateKeys![indexPath.section]] self.selectedFile = files![indexPath.row] } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if (segue.identifier == "SegueToFileDetails") { let destinationViewController = segue.destinationViewController as! FileDetailsViewController destinationViewController.file = self.selectedFile } } […]

DidSelectRowAtIndexPath使用故事板

在我的应用程序我使用下面的didSelectRowAtIndexPath方法去一个viewController,但我正在一个故事板内工作,并引发exception告诉我,找不到nib文件。 我应该如何改变方法来打开新的viewController没有例外? //link to the next view -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { EmpresasTableViewController *detailViewController = [[EmpresasTableViewController alloc] initWithNibName:@"EmpresasTableViewController" bundle:nil]; detailViewController.title =[[categorias objectAtIndex:indexPath.row]objectForKey:@"idCategoria"]; detailViewController.categoriaDescription = [categorias objectAtIndex:indexPath.row]; [self.navigationController pushViewController:detailViewController animated:YES]; }

在TableView上添加一个SearchBar

我想在我的tableview中添加一个search栏,里面填充了来自Core Data的数据。 下面是我的TableViewController的代码的一部分。 在tableview中放置一个后,如何开始执行search栏function? let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext var fetchedLastName = [String]() var fetchedFirstName = [String]() var fetchedImage = [UIImage]() override func viewDidLoad() { super.viewDidLoad() NSNotificationCenter.defaultCenter().addObserver(self, selector: "reloadData:",name:"load", object: nil) let entityDescription = NSEntityDescription.entityForName("Faculty", inManagedObjectContext: managedObjectContext) let request = NSFetchRequest() request.entity = entityDescription do{ let objects = try managedObjectContext.executeFetchRequest(request) let results = objects […]

带有MagicalRecord巨大数据集的UItableView

我有一个表存储一些数据。 假设数据太大,无法一次加载到内存中。 我想在UItableView中显示这些数据。 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [Item MR_numberOfEntities]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; // How to get object for this row ??? return cell; } 我知道的唯一方法是将所有数据加载到数组中 NSArray *items = [Item MR_findAll]; 但我不想这样做。 用户将显示前10行,为什么我应该从CoreData加载它们。 有什么办法使用MagicalRecord一个接一个地取出它们吗?