viewdidappear

How do I set the text of a label from outside of viewDidAppear?

前提是你 提交于 2021-02-11 13:24:45
问题 I'm writing a Mac (Swift) application on Xcode which gets data from a command and asynchronously changes the stringValue of some text in the window. I already figured out the asynchronous part from here, but I can't seem to figure out how to actually change the text, since Xcode seems to require it to be in viewDidAppear . Unfortunately I can't put the function which runs the command in viewDidAppear since it is called by another file and needs to be a public func (as far as I know). Here are

iOS/Swift: in which function between viewDidLoad and viewWillAppear am I supposed to query a database?

前提是你 提交于 2020-01-05 01:01:35
问题 In my app, being developed by Swift and XCode 6, I have to query a database and according to that answer then I'll modify and show some UI widgets which, in my case, are three colored buttons whose I have to change their text which consists in a number. These buttons indicate the number of tasks assigned to an user and they have different colors according to the tasks' priority. So, shall I query the database in viewDidLoad() function and then change the buttons' text in viewWillAppear

Swift - viewing different position on viewDidLoad and viewDidAppear

那年仲夏 提交于 2020-01-03 01:15:44
问题 I have an understanding problem... I created two similar views (same origin and same size) and section view, While i created those views - one in viewDidLoad and the other in viewDidAppear - when i put similar starting point in the origin x and y of each view that refer to section i get those views in different position. Can someone explain me what is the reason that those views isn't in the same position? import UIKit class ViewController: UIViewController { @IBOutlet var sec: UIView!

iOS 6 maps- not animating PIN drop

血红的双手。 提交于 2020-01-02 09:11:10
问题 I have created a custom MKAnnotation class and it has been working - until iOS 6 came out. Since then my pins get added to the apple map but now without a drop animation! Is this how it is set or there maybe an an issue with the way I'm doing things. I have set a delay of 1 sec until the method that adds the annotations to the map is called, so I can see if the drop animations are actually occurring before the view appears - still, the pins just appear out of nowhere without dropping. Here's

iOS: Updating text labels with NSUserDefault data on different views

走远了吗. 提交于 2019-12-25 06:19:09
问题 I have a text label on view 1 and a button. If I click the button, I am brought to view 2 through a modal connection. In this view, I enter a number and press a button. The button saves the number to NSUserDefaults, as well as tries to update the text label on view 1 to reflect this number. Button's code: - (IBAction)returnToView1:(UIButton *)sender { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; defaults setObject:@"myNumber" forKey:@"myKey"]; [defaults synchronize];

iOS: Updating text labels with NSUserDefault data on different views

懵懂的女人 提交于 2019-12-25 06:19:06
问题 I have a text label on view 1 and a button. If I click the button, I am brought to view 2 through a modal connection. In this view, I enter a number and press a button. The button saves the number to NSUserDefaults, as well as tries to update the text label on view 1 to reflect this number. Button's code: - (IBAction)returnToView1:(UIButton *)sender { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; defaults setObject:@"myNumber" forKey:@"myKey"]; [defaults synchronize];

with “viewDidLoad” my viewController take much time to appear!

二次信任 提交于 2019-12-24 01:25:13
问题 when i load my viewController i used "viewDidLoad"method to init my view ,but this take much time to make the view appeared .So i had the idea to use "viewDidAppear" method to accelerate the appearance of my view but the load of the informations about my view are now loaded to the memory every time that i push my view (which is normal) or i pop to it(and there is my problem) Have you an idea? 回答1: Create a background task that is started in viewDidLoad and just updates the GUI when it's

UIViewController resizing itself between viewWillAppear and viewDidAppear?

本小妞迷上赌 提交于 2019-12-24 00:55:17
问题 I've got a really strange bug in my project. I've got a UIScrollView as my main, big view. Inside of it, I have a UIViewController (not UITableViewController ) which has a UITableView instance variable, as well as some miscellaneous UIButtons . I have set the view controller's view frame to CGRectMake(0, 64, 320, 388) , as I have a tab bar above it (this is not functional yet). At first it works great and looks great, but once I present and dismiss a modalViewController (thus reloading the

Show a View on First Launch Only - Swift 3

我的未来我决定 提交于 2019-12-23 05:08:27
问题 I am implementing a Terms & Conditions view into my app and the user has to accept them to proceed, then when they do accept them, they no longer have to go through the Terms & Conditions view. I followed a tutorial on how to integrate UserDefaults and store the value locally if someone does accept the terms. However I am stuck with implementing it into the root view controller. Specifically stuck on my viewDidAppear function. What goes in the if and else statements? class

Different behaviour in iOS 7 and iOS 8 on -(void)viewDidAppear:(BOOL)animated on Partial Curl VC

删除回忆录丶 提交于 2019-12-20 06:13:32
问题 -(void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; //Reset all NSUserDefaults values } My app was previously working fine in iOS 7 but after upgraded to iOS 8, it is no longer working. This is happening in my parent VC where user is required to select some option in another (child) VC which transit via "Partial Curl". In iOS 8, seems like all my options are not saved in child VC anymore when I transit back to my parent VC. FYI I store my options selection in child VC inside