uitableview

UITableview content size gets wrong while using estimated height

梦想与她 提交于 2020-01-26 04:12:07
问题 I am getting empty space while I am using the Table view content size . I referred this like https://forums.developer.apple.com/thread/81895 . But it did not work for me. When I call to get the table content size , it gives wrong size for example, if table view content size was 100 means then it gives me 140 or 80 like...etc. So, If anyone knows how to handle OR how to get correct table view content size ?? 回答1: use the below code once override func viewDidLoad() { super.viewDidLoad()

How to move the focussed text field to the middle of the view after keyboard popups

我怕爱的太早我们不能终老 提交于 2020-01-26 04:05:06
问题 In my iPad im creating SplitView application. I have a UITableVewtable with multiple rows, each row/cell having three UITextField When i tap on UITextField some fields are hide by the keyboard. So im using TPKeyboardAvoidingScrollView framework but it does not works on ios 5.0+. some times unable to scroll the scroll view on the table. So I want to move the focussed cell to the middle/ just above the key board at every time What should I use? Thanks in Advance. 回答1: Try this code. Put this in

Swift UITableViewAutomaticDimension not working

早过忘川 提交于 2020-01-26 02:32:03
问题 I am trying to get auto re-sizing of my table cells working. I have simplified my cells so that I just have a single label. When running my code in the simulator on a 4s it works fine, but when running on a real 4s device I get a strange gray square over most of the table, and lots of logging with messages like: Will attempt to recover by breaking constraint My understanding of constraints still isnt great, but I have setup a top, bottom, leading and trailing margin on my label. I have the

Swift UITableViewAutomaticDimension not working

空扰寡人 提交于 2020-01-26 02:30:16
问题 I am trying to get auto re-sizing of my table cells working. I have simplified my cells so that I just have a single label. When running my code in the simulator on a 4s it works fine, but when running on a real 4s device I get a strange gray square over most of the table, and lots of logging with messages like: Will attempt to recover by breaking constraint My understanding of constraints still isnt great, but I have setup a top, bottom, leading and trailing margin on my label. I have the

Swift: fixed searchBar into tableView header

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-25 21:54:25
问题 I have a tableView with a searchBar inside the table header. Everything is working well except when I scroll down the rows, the search bar disappear. How can I make it fixed? 回答1: There is no a way to maintain the header of a tableView fixed, but an useful approach when you need a unique header, could be to use UIViewController instead of UITableViewController, and set the header (UIView that contains searchBar) above the tableView. 来源: https://stackoverflow.com/questions/45147582/swift-fixed

self.tableview reloadData causing crash in UITableView

空扰寡人 提交于 2020-01-25 21:45:52
问题 I'm getting this crash when selecting a row: '-[__NSCFArray objectAtIndex:]: index (1) beyond bounds (1)', I moved the data out of the viewWillAppear because we though it was causing a crash. I now have it loading on ViewDidLoad. However if the [self.tableview reloadData]; is on, I get this crash. Ideas? -(void) loadData3;{ MyAppDelegate *AppDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; self.tableDataSource3 = [AppDelegate.data3 objectForKey:@"Rows"]; NSLog(@

self.tableview reloadData causing crash in UITableView

时光毁灭记忆、已成空白 提交于 2020-01-25 21:45:07
问题 I'm getting this crash when selecting a row: '-[__NSCFArray objectAtIndex:]: index (1) beyond bounds (1)', I moved the data out of the viewWillAppear because we though it was causing a crash. I now have it loading on ViewDidLoad. However if the [self.tableview reloadData]; is on, I get this crash. Ideas? -(void) loadData3;{ MyAppDelegate *AppDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; self.tableDataSource3 = [AppDelegate.data3 objectForKey:@"Rows"]; NSLog(@

ios UITableView行内嵌横向UICollectionView

北城余情 提交于 2020-01-25 18:44:32
ios UITableView行内嵌横向UICollectionView 1.在要添加CollectionView的行类添加UICollectionViewDelegate代理,并添加CollectionView的输出口 @interface XMWorkSpaceFristTableViewCell : UITableViewCell < UICollectionViewDelegate , UICollectionViewDataSource > @property ( weak , nonatomic ) IBOutlet UICollectionView * workspaceCollectionView ; @end 2.在这个TableViewCell.m里添加代理方法 - ( NSInteger ) numberOfSectionsInCollectionView : ( UICollectionView * ) collectionView { return 1 ; } // 设置cell大小 itemSize:可以给每一个cell指定不同的尺寸 - ( CGSize ) collectionView : ( UICollectionView * ) collectionView layout : ( UICollectionViewLayout * )

How can I know if a cell of UITableView is selected?

孤者浪人 提交于 2020-01-25 11:39:07
问题 I am writing an app in Swift with XCode. It includes a UITableView . Just one question - in Swift, how can I tell what cell is selected by the user? To clarify: A user selects the cell with the label "foo" The code should return "foo", or whatever is selected by the user 回答1: You can tell what cell is selected by User by adding following function in your view controller. class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { ... func tableView(tableView:

How to pass an object in a segue rather that a detail of an object?

回眸只為那壹抹淺笑 提交于 2020-01-25 11:30:47
问题 I have a simple notes app where I have just 2 view controllers: table view controller - to list all the notes. view controller - to create new notes. In the table view controller I have a segue from a cell back to the creation page where a user can edit the note in this specific cell. But my problem is that when I'm preforming editing to a certain cell(note) I'm creating a new note with the content of what I edited... So instead of passing the note content in the prepareForSegue method I need