uitableview

TableViewDatasource and delegate not called when tableview is inside collectionview cell

*爱你&永不变心* 提交于 2020-01-06 19:29:08
问题 I have placed a uitableview inside collectionviewcell and have coded as below in the collectionviewcell class.But the datasource and delegate methods are not being called can any help me out to fix the issue - (id)initWithCoder:(NSCoder *)aDecoder { if (self = [super initWithCoder:aDecoder]) { arrayMenuAlerts=[NSMutableArray arrayWithObjects:@"Suri",@"John",@"Phillip",@"Sachin", nil]; [self.contentView addSubview:tableView]; tableView.dataSource=self; tableView.delegate=self; } return self; }

UITableView doesn't refresh when NSPredicate set

流过昼夜 提交于 2020-01-06 18:43:31
问题 Preface: I tried [self.tableview reloadData] . My app doesn't crash, but it doesn't refresh, either. I'm trying to display 2 sets of results on one TableViewController depending upon whether an NSPredicate is set. I'm trying to find a jargon free answer how I can update a UITableViewController once a predicate is set. My data displays properly the when the view initially loads. My predicate sets properly, all the log statements I've thrown in return values...but nothing happens when it's set.

Issue with getting cell's string using a button in a custom UITableViewCell

久未见 提交于 2020-01-06 18:38:48
问题 I am trying to get cells' string using a button in a custom UITableViewCell .But when I tap the button app crashes due to this error : fatal error: unexpectedly found nil while unwrapping an Optional value . I tried print something and it works!.but when I try to get other cells' string app crashes. Here is my code : func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var cellID:String! var cell = OrderCell() switch indexPath.section { . . . . .

Issue with getting cell's string using a button in a custom UITableViewCell

☆樱花仙子☆ 提交于 2020-01-06 18:37:29
问题 I am trying to get cells' string using a button in a custom UITableViewCell .But when I tap the button app crashes due to this error : fatal error: unexpectedly found nil while unwrapping an Optional value . I tried print something and it works!.but when I try to get other cells' string app crashes. Here is my code : func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var cellID:String! var cell = OrderCell() switch indexPath.section { . . . . .

Request for member tableView in something not a structure or union

醉酒当歌 提交于 2020-01-06 18:33:52
问题 Please help with this issue, I'm trying to populate my table cells with coreData db; I'm porting an example from iPhone to iPad, the problem is that in the iPad in my table view. I'm using: @interface FailedBanksViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, NSFetchedResultsControllerDelegate> not the @interface FailedBanksListViewController : UITableViewController <NSFetchedResultsControllerDelegate> for the whole table view but a table inside my view, so I

How to compare two dictionary key values and print text in cell in iOS?

做~自己de王妃 提交于 2020-01-06 18:30:33
问题 I have two dictionary with multiple items. I want to compare values. Dict1:{ "Displacement_trim" = "49.26 "; "Dry_Weight" = "<null>"; } Dict2:{ "Displacement_trim" = "171.20 "; "Dry_Weight" = "<null>"; } I want to know which "Displacement_trim" is greater. Also checking null values. Print the data in cell. How can I achieve this? 回答1: To find out which value from the dict is bigger use the following code: Swift 3 let dict1 = [ "Displacement_trim" : "49.26", "Dry_Weight" : "<null>" ] let dict2

Not populating tableview with structure array

久未见 提交于 2020-01-06 17:56:47
问题 I need to populate my tableView with an array of a structure. The first property of the structure is the name. This is what I tried... var menuArray:[Restaurant] = [Restaurant]() override func viewDidLoad() { super.viewDidLoad() let shake = Item(name: "Shake", carbs: 20) let fries = Item(name: "Fries", carbs: 30) let beverages = Category(name: "Beverages", items: [shake]) let chips_fries = Category(name: "Chips & Fries", items: [fries]) let desserts = Category(name: "Desserts", items: []) let

How to change selected cell of UITableViewController when coming back to the table view?

╄→гoц情女王★ 提交于 2020-01-06 15:51:59
问题 When you select a cell and move to detail view and go back to the table view by tapping back button , the background color of the cell you selected last time is highlighted. How can I highlight another cell which is not selected before, when coming back to the table view from detail view? For example, in case of Apple's Music app, when you select and play a song and change the song by tapping next track button and go back to the song table view, the highlighted cell is not the song you

Cannot reload table view in IOS7

风流意气都作罢 提交于 2020-01-06 15:34:13
问题 I am a quite new to IOS development and keep having struggle with it. I would like to display phone list which an user has from my server but tableview does not display items. I have got data from server well and I think settings for UItableView is correct. Here is my code: STKPhoneHolderViewController.h #import <UIKit/UIKit.h> #import "STKSimpleHttpClientDelegate.h" @interface STKPhoneHolderViewController : UITableViewController <UITableViewDataSource, STKSimpleHttpClientDelegate> @property

How to add cell dynamically in uitableviewcontroller?

我是研究僧i 提交于 2020-01-06 15:26:49
问题 cell which having two textFields... And on click ADD button I want to add that cell dynamically in tableview. And also delete row. And text on both textField should not get change during scroll and on adding new cell... And at the end I want all text field value in array of Dictionary.. following the code I have tried - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return