Thank you. I thought it should work. I must be doing something else wrong.
I'll keep at it. It's got to be something simple.
Take care!
Post
Replies
Boosts
Views
Activity
Sorry - I didn't see your question at the bottom until just now.
If I comment out that line of code, the subview remains where it shows up in the parent - at origin 0,0.
Your suggestion that my problem may lie in the xib is something I need to look into. I am pretty new to all this, so I might be missing something.
Thank you, again!
Well, I solved the problem days ago using Outlets to grab references to the menu objects in the NIB and also used constraints position and then reposition them, rather than trying to manipulate the 'center' properties.
It also had something to do with the way I was setting up the NIB positioning criteria in the UI Builder - still haven't quite figured that out yet...
Thanks to all for your input!
Take care!
Hey!
Thank you for the quick response!
After all the research I just did this morning, I can see how that would work, but I never would have thought to do it that way myself.
Main question, Apple - Why does getting something so simple have to be so freaking hard now? When is enough enough in expanding the capabilities of iOS? And who the heck is gong to run multiple instantiations of the same app on an iPad???
Just me ranting at the wasted time.
Thank you for you solution. I'll let you know if it works (I'm pretty sure it will!).
Okay. Attempted to use your code as follows (including only changed / added code):
extension UIApplication {
...
while true {
if let presented = topViewController?.presentedViewController {
topViewController = presented
...
} else if let cptVC = topViewController as? CPTViewController {
topViewController = cptVC
} else {
break
}
}
return topViewController
}
}
// Used like this:
let cptVC = UIApplication.shared.topViewController()
...
(cptVC as! CPTViewController).hidePOI(). // Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Don't know what I'm doing wrong, but it feels like everything else in Swift - like I'm having to cluge things together until there are no indicated errors, but most of the time don't work anyway. I feel like it's my lack of knowledge somehow, but I don't know what I'm missing.
Main questions:
Why doesn't the declaration of cptVC (in the 'Used like this' section) carry the CPTViewController type from the extension?
I understand why cptVC has to be unwrapped (its an optional result), but I don't understand why it has to be type-cast when used.
Bah!
Thank you again for the quick response!
I’ll give it a try.
Wil