Post

Replies

Boosts

Views

Activity

Reply to Show UIImageView for 1 second and hide again
When I execute the function, the button appears (hidden = false) and then I have an animation that in a certain time (1s) varies the alpha from 1 to 0, upon completion it returns the value to 1 (thanks to you) and maintains I hide the image ( hidden = true ). It is right? Before you call, image is hidden and alpha is 1 (by default as defined in IB probably) Before animation, you unhide : image is visible Then animation is to change progressively alpha from 1 to 0 ; hidden remains false At the end of animation, you hide the image again. and you need to reset alpha to 1, otherwise next time you play you start at 0 You could also have written it at start: func showIcon() { statusField.isHidden = false statusField.alpha = 1 //<-
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’21
Reply to Unable to enter text in programmatically created UITextField
I created a plain vanilla objC project. From what you show I had to change: remove [self.window makeKeyAndVisible]; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. // [self.window makeKeyAndVisible]; // << removed return YES; } correct the addSubview statement by removing dot before addSubview     [self.view addSubview:text]; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. // Creates a text field somewhere near-ish to the center of the screen UITextField* text = [[UITextField alloc] initWithFrame:CGRectMake(50, 100, 200, 50)]; text.borderStyle = UITextBorderStyleRoundedRect; text.returnKeyType = UIReturnKeyDone; // Set the view background as white just to make sure we're in the right place... self.view.backgroundColor = [UIColor whiteColor]; [self.view addSubview:text]; } It works OK. The same works OK in Swift. In a plain VC. You could try to: option-clean build folder (one never knows!) -set the delegate for the textField (but that should not be needed) toggle keyboard from hardware / Software, just to see (cmd-K and cmd-shift-K) remove those 2 lines to simplify even more: text.borderStyle = UITextBorderStyleRoundedRect; text.returnKeyType = UIReturnKeyDone;
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’21
Reply to Slide over UIViews To Select
You need to track the finger position using func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) and func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) Then compute which bar it is and display information accordingly in touchesMoved.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’21
Reply to why it says "this class is not key value coding-compliant for the key forgotPassword.'?"
I want to use segue when I click the forget password icon , I do not see any segue in your code, just an IBAction call… One of the frequent reasons for such a crash is that you miss a connection to an IBOutlet from the storyboard, or that this connection is corrupted (if you have changed a name for instance). So, remove all connections from IN to LoginViewController and rebuild them. Do a clean build folder after, in case. Note: you have a typo (missing an n): forgotPasswordEmailCheckCotroller. But that's not the cause of the problem. Why don't you set directly the storyboard ID ForgotPasswordEmailCheckController directly in IB ?
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to Calculation of maximum speed and traveled distance Core Location
When you init a CLLocation, you can ask to get speed info at each measure. Then, store this value in an array. And evaluate the max value in the array to get max speed, when you need. What distance do you want to measure: the travelled or the distance from origin ? For travelled distance, each time you get a CLLocation value, compute the distance from previous point (if update is frequent enough, evaluate this as sort(dx*dx + dy+dy) where (dx, dy) is the delta between the two CLLocation. Then increment a totalDistance Float value to compute the travelled distance so far. May read this for implementation details. https://stackoverflow.com/questions/38512443/provide-simple-method-to-get-current-speed-implementing-speedometer
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21