uitableview

Xcode Error: Outlets cannot be connected to repeating content

早过忘川 提交于 2020-02-14 05:40:11
问题 After doing some searching and editing, I can't seem to find a solution to fixing this error. I'm trying to link my location search results with a table to display the search results in a list-form. I have my map with the details button linked with a UIViewController called 'FirstViewController.' My results table is linked with a UITableViewController called 'ResultsTableViewController.' My prototype cells are linked with a UITableViewCell called 'ResultsTableCell' which is also where my

iOS 开发 UItableView中滑动删除 cell

孤街醉人 提交于 2020-02-14 05:39:55
主要是就是两个函数 一: - ( void ) tableView: ( UITableView * ) tableView commitEditingStyle: ( UITableViewCellEditingStyle ) editingStyle forRowAtIndexPath: ( NSIndexPath * ) indexPath 相应 editingStyle事件处理 在这里主要相应 UITableViewCellEditingStyleDelete: 二: (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 在这个函数中设置那个cell设置成 什么样的editingStyle删除,插入,无 UITableViewCellEditingStyleDelete UITableViewCellEditingStyleInsert UITableViewCellEditingStyleNone 需要注意的问题 :在删除对应cell中的内容时,也要删除这个cell,否则运行时显示效果就像没有刷新 一样,多出一个cell。而使用 [tableView reloadData];[self

Displaying NSMutableAttributedString on iOS 8

*爱你&永不变心* 提交于 2020-02-13 04:36:43
问题 Seems on iOS 8.0 (12A365) NSMutableAttributedString sometimes will not be displayed correctly. The problem obviously occurs when the range of the attribute does not start at the beginning of the text (and if there is no other attribute starting at the beginning of the text). So with 1.) the second word "green" in will not show the green background (bug!) ("cell" is a UITableViewCell with UILabel "label" as a subview): 1.) text = [[NSMutableAttributedString alloc] initWithString:@"Green is

Displaying NSMutableAttributedString on iOS 8

给你一囗甜甜゛ 提交于 2020-02-13 04:36:10
问题 Seems on iOS 8.0 (12A365) NSMutableAttributedString sometimes will not be displayed correctly. The problem obviously occurs when the range of the attribute does not start at the beginning of the text (and if there is no other attribute starting at the beginning of the text). So with 1.) the second word "green" in will not show the green background (bug!) ("cell" is a UITableViewCell with UILabel "label" as a subview): 1.) text = [[NSMutableAttributedString alloc] initWithString:@"Green is

【iOS知识学习】_iOS动态改变TableView Cell高度

雨燕双飞 提交于 2020-02-12 04:15:55
在做tableView的时候,我们有时候须要依据cell的高度动态来调整。近期在网上看到一段代码不错。跟大家Share一下。 在 -( UITableViewCell *)tableView:( UITableView *)tableView cellForRowAtIndexPath:( NSIndexPath *)indexPath{ 类中获取cell的高度: CGSize boundSize = CGSizeMake(216, CGFLOAT_MAX); cell.textLabel.text = @"12345678900123456789"; cell.userInteractionEnabled = NO; cell.textLabel.numberOfLines = 0; CGSize requiredSize = [cell.textLabel.text sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:boundSize lineBreakMode:UILineBreakModeWordWrap]; CGRect rect = cell.frame; rect.size.height = requiredSize.height+5; cell.frame = rect;

Get Height of Table Contents in Swift

江枫思渺然 提交于 2020-02-11 07:14:25
问题 I'm trying to get the height of all of a table's contents so I can update the container it is in. This will allow the container and other views in the scroll view to scroll together. 回答1: Swift : var tableViewHeight: CGFloat { tableView.layoutIfNeeded() return tableView.contentSize.height } Objective-C - (CGFloat)tableViewHeight { [tableView layoutIfNeeded]; return [tableView contentSize].height; } 回答2: Swift 3 override func viewDidLoad() { super.viewDidLoad() myTbleView.addObserver(self,

UITableView的基本使用

自闭症网瘾萝莉.ら 提交于 2020-02-08 19:07:11
UITableView基本使用 展示多组数据 # import "ViewController.h" @interface ViewController ( ) < UITableViewDataSource > @property ( nonatomic , weak ) IBOutlet UITableView * tableView ; @end @implementation ViewController - ( void ) viewDidLoad { [ super viewDidLoad ] ; self . tableView . dataSource = self ; } //告诉TableView一共有多少组 - ( NSInteger ) numberOfSectionsInTableView : ( UITableView * ) tableView { return 4 ; //展示4组数据 } //告诉TableView第section组有多少行 - ( NSInteger ) tableView : ( UITableView * ) tableView numberOfRowsInSection : ( NSInteger ) section { if ( section == 0 ) { //第0组有多少行 return 2 ; } else if

Swift tableView checkmark repeating on scroll

心已入冬 提交于 2020-02-08 10:08:04
问题 I'm fairly new to swift and developing, I'm looking for some help with a problem I can't get past. So essentially I have a bunch of custom class's which detail workouts, I use those workouts to populate the table view to show the user a list of exercises in the chosen particular workout. I want to be able to place a checkmark next to an exercise within the table view once it has been completed, the issue I am having is the checkmark repeats when I scroll, I have now removed it for new cells

Root View Controller Swift

醉酒当歌 提交于 2020-02-08 09:15:36
问题 I have a function in my app delegate which appends an item to an array in my a file named ViewController.swift, and then I want to reload a tableview in that same file. I attempt to do so like so: let vc = ViewController() let navigationController = UINavigationController(rootViewController: vc) window!.rootViewController = navigationController println(vc.messages) //1 vc.messages.append(message.data.message as! String) //2 vc.MessageTableView?.reloadData() The lines numbered 1,2 are where I

Root View Controller Swift

99封情书 提交于 2020-02-08 09:14:44
问题 I have a function in my app delegate which appends an item to an array in my a file named ViewController.swift, and then I want to reload a tableview in that same file. I attempt to do so like so: let vc = ViewController() let navigationController = UINavigationController(rootViewController: vc) window!.rootViewController = navigationController println(vc.messages) //1 vc.messages.append(message.data.message as! String) //2 vc.MessageTableView?.reloadData() The lines numbered 1,2 are where I