uitableview

Customising the font/background colour of index/section bar in UITableView

混江龙づ霸主 提交于 2020-01-10 17:33:10
问题 I've read in another thread on SO that you can adjust the font or background colour of the index bar (that is the A-Z # scrollbar) in a UITableView adding a CALayer. My app will be running on iOS 5 and above and since I haven't seen anything about this in the Apple docs, would it be right to say that it simply isn't possible without creating a custom table view? If this is possible (and acceptable to Apple), how would I go about doing this? 回答1: As of iOS 6.0 there are two methods that allow

Change background of a grouped UITableView

瘦欲@ 提交于 2020-01-10 12:01:38
问题 I'm having some trouble trying to change the background of a UITableView with groups. _tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"tableViewBg.png"]]; This usually works on every other UITableView, but not the one with groups, is there something else I have to do? In IB I have the background color set to a clear color, but that doesn't do much. 回答1: You additionally need to disable the background view of _tableView : [_tableView setBackgroundView:nil];

Change background of a grouped UITableView

风流意气都作罢 提交于 2020-01-10 11:58:11
问题 I'm having some trouble trying to change the background of a UITableView with groups. _tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"tableViewBg.png"]]; This usually works on every other UITableView, but not the one with groups, is there something else I have to do? In IB I have the background color set to a clear color, but that doesn't do much. 回答1: You additionally need to disable the background view of _tableView : [_tableView setBackgroundView:nil];

Swift - UITableView inside UIViewController, UITableView functions are not called

痞子三分冷 提交于 2020-01-10 09:34:11
问题 I inserted a tableview inside a UIViewController. But my code is not working. When I checked I found that none of the tableview functions are not called. class CustomViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var authorArticlesTableView: UITableView! var authorid: Int! var authorname: String! var articles: [JSON]? = [] func loadArticles(){ let url = "http:here.com/" + String(authorid) + "/" println(url) Alamofire.request(.GET, url)

Swift - UITableView inside UIViewController, UITableView functions are not called

大城市里の小女人 提交于 2020-01-10 09:33:13
问题 I inserted a tableview inside a UIViewController. But my code is not working. When I checked I found that none of the tableview functions are not called. class CustomViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var authorArticlesTableView: UITableView! var authorid: Int! var authorname: String! var articles: [JSON]? = [] func loadArticles(){ let url = "http:here.com/" + String(authorid) + "/" println(url) Alamofire.request(.GET, url)

UITableview edit/done button

喜你入骨 提交于 2020-01-10 08:21:08
问题 I have a tableview and navigation bar on the top. I have a Edit button on the left of my navigation bar with the following line of code. self.navigationItem.leftBarButtonItem = self.editButtonItem; When i click on the edit button, it changes to done button. All is fine so far. Where do i add code, if i want to do a small operation when the Done button is clicked.? 回答1: The button stops committing the changes to your controller class once you override it's default action with self

Programmatically emulate the selection in UITableViewController in Swift

允我心安 提交于 2020-01-10 07:42:06
问题 Sorry for the question without any line of code. I need advice how to proceed, if at possible that I want. In Swift language. Let us assume there is an app with two controllers - UITableViewController with embedded NavigationController , as the main. When you select a row in the table, opens UIViewController , which displays detailed information about the selected value. Is it possible to do otherwise? When the application start, programmatically emulate the selection of the first row in the

Swift - how to make custom header for UITableView?

▼魔方 西西 提交于 2020-01-10 07:33:19
问题 I need to add custom header to my table I try this func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 18)) let label = UILabel(frame: CGRect(x: 20, y: 20, width: 50, height: 50)) label.text = "TEST TEXT" label.textColor = UIColor.whiteColor() self.view.addSubview(view) return view } but this doesn't work, I see nothing on table What am I doing wrong ? Or maybe there is

Turning an NSArray of custom objects into a alphabetically sectioned UITableView with an index?

北战南征 提交于 2020-01-10 06:11:28
问题 (hmm.. long title) If I start out with an NSArray of custom objects (each object is a Person) like this: { surname:Allen forename: Woody, surname:Baxter forename: Stanley, surname:Clay forename: Cassius } ..etc.. You can see that the array is already in surname order. How do I use that array to create a a UITableView with a section headers A, B C etc, as well as an index thing on the side running vertically A B C EDIT I guess what I'm asking is how to turn my array of objects into a Section

Multi level categories with items on all levels in UITableView

落花浮王杯 提交于 2020-01-10 06:06:31
问题 I have to create a UITableView using the JSON response below ( Array ). I have no code for this yet but would love some direction to how i would split this array to accommodate categories and items on all levels. { "result":{ "products":[ { "id":"4", "product_code":"PR04", "title":"Product1", "franchisee_id":"118" } ], "categories":[ { "id":"8", "name":"Category1" }, { "id":"20", "name":"Category2", "products":[ { "id":"9", "product_code":"PR07", "title":Product2, "franchisee_id":"118" } ] }