I'm learning swift, but sometimes when i look at answers to questions and some of them are impenetrable. How do I implement the following?
If you call - [UITableView setFrame:] from - [UITableViewController viewDidAppear:], it works:
- (void)viewDidAppear:(BOOL)animated { [self.tableView setFrame:CGRectMake(x, y, w, h)]; }
In order to avoid having black bars on each side of the table view, set the background color of the application's main window to white:
[[[UIApplication sharedApplication] keyWindow] setBackgroundColor:[UIColor whiteColor]];
Do I override view did appear? what is with the -(void)
, and why is the self.tableView
line in brackets, and what's the final line represent?
As @Alladinian mentioned, it's Objective-C. Another language you can use for iOS development.
You can get basics of language for example on wiki
Answering your question, in swift it will look like:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
tableView.frame = CGRect(x: x, y: y, width: w, height: h)
}
and
UIApplication.shared.keyWindow?.backgroundColor = UIColor.white
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.