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
Reply to Adding functionality to JSONDecoder (json decoding)
If I understand correctly, you don't know in fact the exact type of canJump ? Have a look here to use unknown type: https://stackoverflow.com/questions/52896731/how-to-use-jsondecoder-to-decode-json-with-unknown-type
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21
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:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Getting back from Splitview
I did this: add an entry in the masterView left table with code for this row in didSelectRow             self.dismiss(animated: true, completion: nil) Seems to work.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Method in Date extension not found in one class while works in another
Did you do the option-clean build folder ? Where is the extension defined ? In which file ? Is in in the another class the extension works as expected If so, try to define outside of any class.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Method in Date extension not found in one class while works in another
Exact, I did not notice option-clean was now disabled. Just use Clean Build Folder. Could you show the 2 class definitions and post a screen copy of the Identity and type Inspector info for the files of the 2 classes ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to How to make the Table cell editable
Could you show the relevant code ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Collection view not displaying Cells
Replace         cell.textLabel?.text? = name by         cell.textLabel!.text = name And it works. You can test for safety: if cell.textLabel != nil {         cell.textLabel!.text = name }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Swift MacOS App Create XLSX
The format for xlsx is pretty complex. That would be probably painful to develop. What you could do is create either a SYLK or a CSV file and open later in Excel. That's much easier to do.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Why I am not able to click button and back to ViewController?
Is it the complete code ? CloseButton is not added to the view, how do you get it on screen ? You should also define its frame. Could you show how you transition to secondView ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How to Handle NULL in Swift?
In Swift, generally use nil instead of NULL.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Binding -> Return from initializer without initializing all stored properties
You probably have other properties declared in addition to searchableText, and you don't initialize them…
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Jul ’21