Posts

Showing posts with the label uitableview

How can I move the clear button in a UITextField?

Image
Clash Royale CLAN TAG #URR8PPP How can I move the clear button in a UITextField? For some reason, when I add a UITextfield as a subview of the contentview of a tablecell, the clearbutton does not align with the text typed in the field, and appears a bit underneath it. Is there any way I can move the text of the clearbutton to stop this from happening? Thanks for any help, 6 Answers 6 I haven't seen this, and a screen shot would be helpful. But, the quick answer is that you can inspect the subviews array of the UITextField, find the subview that contains the clear button, and adjust its frame.origin. Edit: It seems I've been downvoted for this answer (written in 2010). This is of not an "officially" approved method because you're manipulating private objects, but it's not detectable by Apple. The main risk is that the view hierarchy might be changed at some point. ...

How to change UITableView Label to mutiple color

Image
Clash Royale CLAN TAG #URR8PPP How to change UITableView Label to mutiple color How do I change the text in my UITableView to two different colors? let highest = (history[indexPath.row].highest!) //Red color let lowest = (history[indexPath.row].lowest!) //Green color cell.detailTextLabel?.text = "$(highest)/$(lowest)" return cell Thank you! use attributed text for this use two colors one for lowest and other highest – Vinodh 3 mins ago 1 Answer 1 You can prepare a custom view with two labels, one for highest, other for lowest. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your ...

How do I pass indexPathForSelectedRow into a UITabView via a UITabBarController?

Image
Clash Royale CLAN TAG #URR8PPP How do I pass indexPathForSelectedRow into a UITabView via a UITabBarController? I'm trying to segue from a UITableView to a specific tab within a UITabBarController . While googling, I found two sets of info that seem to indicate how to do, but neither were using a UITableView as the source. UITableView UITabBarController UITableView The first source is this wonderfully written answer I found here on StackOverflow: How to make a segue to second item of tab bar? The second source was this site: http://www.codingexplorer.com/segue-uitableviewcell-taps-swift/ I have been attempting to combine the two for my app. Below is a truncated version of my originating UIViewController (I can post the full one if needed, just most the code isn't related to this segue, I don't think): class BonusListViewController: UITableViewController { // MARK: - Table View Configuration override func numberOfSections(in tableView: UITableView) -> Int { ...

How to get values inside nested keys in Firebase on Swift

Image
Clash Royale CLAN TAG #URR8PPP How to get values inside nested keys in Firebase on Swift I'm trying to get values inside two nested keys in Firebase. : I need to put all the value of name inside an array. Here is my code where I'm accessing just the node "user". I was thinking that I could use "queryOrderedByKey" one after another, but in that case xCode crashes and says something like multiple quires aren't allowed. Database.database().reference().child("user").queryOrderedByKey().observe(.childAdded) { (snapshot) in if snapshot.value != nil { let result = snapshot.value as! [String : AnyObject] if let name = result["name"] as? String { self.myArray.append(name) } DispatchQueue.main.async(execute: { self.tableView.reloadData() }) } } And this is what I'm getting when printing the result. ...