Tag: uitableview

popup窗口中的UITableView不会滚动

我正试图解决某人的代码,并遇到一个问题。 这是情况:我有一个全屏UIViewController有一个底部的栏button。 当我按下该button时,它会在屏幕左下angular显示一个popup视图控制器。 popup窗口中的视图控制器也有一个button,当我按THATbutton时,它将一个新的视图控制器到我的popup窗口。 这个新的视图控制器是一个UITableView,可以有大量的元素。 问题是,当我尝试向下滚动以查看一些离屏元素时,滚动会弹回到表中的第一个位置,即它不会真的滚动。 更具体的是这里是一些代码: 在FullScreenVC.h中: @property (nonatomic, retain) NSMutableArray* stuffInList; @property (nonatomic, retain) UIPopoverController *namePopover; @property (nonatomic, retain) UINavigationController *nameNav; @property (nonatomic, retain) UIBarButtonItem* addButton; 内FullScreenVC buttonPressed(按下addButton时调用): FirstPopupVC *vc=[FirstPopupVC alloc] initWithNibName@"FirstPopupVC" bundle:nil]; vc.delegate=self; vc.stuffInList=self.stuffInList; // This is just the NSArray of list items self.nameNav = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease]; self.namePopover = [[[UIPopoverController […]

我怎样才能创build一个指定的初始化分组样式UITableViewController?

我有这个UITableViewController的子类: class MyTableViewController: UITableViewController { let foo: String init(foo: String, style: UITableViewStyle = .Grouped) { self.foo = foo super.init(style: style) } required init(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } 没有什么奇特的,不幸的是它不能如预期的那样工作,因为super.init(style: style)会调用MyTableViewController(nibName:bundle:) 。 但是这并没有在我的类中实现,所以应用程序将崩溃,并发生一个fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class错误fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class 。 显然正确的方法是调用指定的初始化程序。 […]

在Swift中,我应该如何保存自定义视图中的数据,以便在单元格出列时不会被删除?

我有一个自定义视图存在于tableview中的单元格中。 该视图被称为bulletRow,它是一系列子弹,当用户点击它们时可以填充或清空。 我的tableview中的每个单元格都包含一些bulletRows,当用户点击它们时我需要保存它们。 我已经考虑过使用核心数据,但是当应用程序closures时,我不需要它们来坚持,只有在用户滚动过去出现点时才需要它。 这是我现在的情况:bulletRows的默认状态是有5个点,所有这些都是空的。 当用户点击它们时,它们变得充满。 如果用户向下滚动,则会重置为空。 我怎样才能保存子弹状态? bulletRows有一个名为numberOfFilledCircles的属性,可以在任何时候设置来改变填充圆的数量。 这一切都是在Swift中完成的。

iOS滚动到UITable视图中的一个部分

没有人知道如何以编程方式滚动表视图到索引path的部分。 我想要做的是有两个部分和if语句的tableview例如 if loading = true scroll the table view up to hide the first section when finished loading scroll table view back down to show first section

从CloudKitlogging中selectcreationDate

我试图用标题和副标题来填充单元格。 标题与字段和细节与CreationDate从logging。 我正在尝试以下,但我得到一个没有成员'ObjectForKey' var objects = CKRecord override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let reuseIdentifier = "Cell" var cell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier) as UITableViewCell? if (cell != nil) { cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: reuseIdentifier) } let object = objects[indexPath.row] cell!.textLabel!.text = object.objectForKey("Notes") as? String cell!.detailTextLabel?.text = object.creationDate.objectForKey("Notes") as? String return cell! […]

iOS Dev:用于UITableView标签的NSArray返回'index 1 out of bounds'

Gday,试图将我的循环tableview数组拆分成它自己的静态数组,然后在UITableView的每个标签上使用… – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"ListingCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } //Load Row Value into NSArray NSString *RowValues = [self.ListingArray objectAtIndex:[indexPath row]]; NSArray *RunTimeArray = [RowValues componentsSeparatedByString:@","]; //Configure the cell. cell.detailTextLabel.text = [RunTimeArray objectAtIndex:1]; //small label […]

通过UITableViewcell以unwind segues推送数据

我有一个push segue,我用它将数据从uitableview单元格传输到文本字段。 该应用程序的计划是,用户将数据input到文本字段,然后他们将点击一个button,它将模式继续到一个表视图控制器,然后他们将select一个可用的视图单元,它将被转回到原始视图他们已经将数据input到文本字段中,tableviewcell内容将被input到同一视图的不同文本字段中。 但我遇到的问题是数据正在从原始文本字段中删除,并且正在创build另一个视图。 所以现在,我试图使用unwind segue所以现在input的数据显示出来,但表视图单元格不像以前那样填充。 这里是推动数据的代码 – – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"showRecipeDetail"]) { NSIndexPath *indexPath = nil; Recipe *recipe = nil; if (self.searchDisplayController.active) { indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow]; recipe = [searchResults objectAtIndex:indexPath.row]; } else { indexPath = [self.tableView indexPathForSelectedRow]; recipe = [recipes objectAtIndex:indexPath.row]; } PersonDetailTVC *destViewController = segue.destinationViewController; destViewController.recipe = recipe; […]

从tableView中的文件目录存储和检索图像?

我正试图从webservice存储在文件目录中的图像。对于存储的图像,我想从文档目录中加载它在表视图。 这些图像可以从一个URL访问,例如: http://Address/App/User/Image/Puegeot_E7 从webservice获取成功,但从文档目录我不断收到null image.Can似乎没有find这里有什么问题。 – (void)saveImage:(UIImage*)image withName:(NSString *)imageName { if (image != nil) { NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString* path = [documentsDirectory stringByAppendingPathComponent:imageName]; NSLog(@"Saving path %@",path); // Saving path /Users/computername/Library/Developer/CoreSimulator/Devices/7277F3D3-298C-451A-8607-8070A08650C7/data/Containers/Data/Application/D3AF4DD9-A4CD-42C8-A8EB-0F15C271EE61/Documents/CabImage/Puegeot_E7 NSData* data = UIImagePNGRepresentation(image); [data writeToFile:path atomically:YES]; } } – (UIImage *)getImageFromURL:(NSString *)fileURL { NSArray *paths […]

用另一个视图为每个UITableViewCellbuild立一个链接

我是iOS编程的新手,我想做一件简单的事情。 我看到了几个有关我的问题的主题,但我不明白为什么我的代码不工作… 我用.xib创build了一个名为details2ViewController的UIViewController子类 在我的主视图叫ViewController.xib ,我有一个tableView 在ViewController.m中 ,我在顶部添加了: #import "details2ViewController.h" 在ViewController.m中 ,我修改了didSelectRowAtIndexPath方法,如下所示: details *det = [[details alloc] init]; [self.navigationController pushViewController:det animated:YES]; 没有任何警告,但是当我点击一个单元格时没有任何效果…我确切地说我没有使用mainStoryBoard。 注意: 这是我以前的post关于这个问题。 (对不起,如果我的英文很尴尬,我是法语…感谢您的帮助!)

禁用所选单元格的prepareForReuse

我有一个自定义的UITableViewCell 。 当一个单元格被选中时,一个UILabel被添加到它。 我不得不使用prepareForReuse来避免混乱,就像这样: – (void)prepareForReuse { NSArray *viewsToRemove = [self.view subviews]; for (UILablel *label in viewsToRemove) { [label removeFromSuperview]; } } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CategorieCell *customCell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath]; return customCell; } 问题是当我向下滚动标签不在视图中,然后向后滚动,标签就不存在了。 原因很明显,因为当单元格被重用时,我删除了所有的标签。 那么是否有一种方法可以禁用所选行的prepareForReuse (或只是方法中的代码),以及如何?