Triggering segues from annotations - objective-c

I found that a previously normally working iPad storyboard started working weirdly upon introducing auto-layout. In particular it seems not to properly show different ViewControllers when clicking different annotations but instead it always shows the first one whatever more annotations are clicked. When I disable auto-layout everything works fine again. Apple responded to my request hinting to a problem in the handling of segues:
#Apple: 'When running a segue from A -> B, it is not our intention that that segue over and over again will result in a chain like A -> B -> C -> D because the original transition is A -> B. However it would make sense if you had a self-referencing segue and you called performSegueWithIdentifier over and over again because you in that case are having the same instance just added to itself. I think you were just getting lucky before and that turning auto layout on was just enough to point that out.'
Yet all the hits I found on the web like in:
How to call a segue from a disclosure button on a map pin?
and
MKMapView show DetailView - How to make a segue
are quite the same as the the code I used and Apple says it is wrong; notwithstanding the iPhone version keeps on working and the problem just arises on the iPad.
Any hint before they crank up another funny suggestion?

Unfortunately the problem, the way it went the way it returned. Eschewing the possibility I ran mad, the same code including the one on the iTunes Store now, started presenting the problem again. I also tested it on another iPad and it presents the same problem leaving me totally in the dark. All the thing seems crazy.

Related

ios 7 - transparency in IB not working correctly? setting transparency programmatically also isn't working?

I have created two UIViewControllers in IB.
PROBLEM 1: I can't make the 2. VC transparent.
I have read a lot of stackOverFlow solutions but nothing seems to work in my case.
I have tried the following setup in IB both in my current project and in this simple project and something strange occurs (IB,for 2.VC):
Setting the alpha value below 0,5
Setting opaque to "checked"
Setting the background color to "black"
https://imageshack.com/i/kqdXWk9Jp
The second VC gets pushed when I click "GO TO NEXT VC" (push or modally , doesn't matter) and while he is being pushed I see the the result I want:
https://imageshack.com/i/idXUCFCPp
... and when the push is finished the new VC changes from being transparent to black (not transparent):
https://imageshack.com/i/iqmLw8D1p
I have no clue why this is happening and I cant get it to stop working like that.
Q1: Why is this happening?
Q2: Why can't I change the properties of the views programmatically when the views are created with IB?
I have done this thousand times WITHOUT using IB. As soon as I start using IB things don't work like they are supposed especially when I try to edit stuff programmatically.
When I do all of these steps without IB only in code everything works perfectly fine but I need to use the IB in my next project. I am using Xcode 5.1.1. on mac mini (late 2009) with Mavericks.
Sorry for bad English.
Your problem is because the memory management of iOS removes the previous interface ViewController, to save resources.
After iOS7, you can customize the transition viewControllers. Please read: UIViewControllerAnimatedTransitioning Protocol Reference.
I also had the same problem and managed to solve it by following the tutorial Custom UIViewController Transitions.
If you are still having doubts, there is another tutorial to help you: iOS7: Custom Transitions.
Hope you get success!

Auto-layout mangles the segues in the iPad version

After a number of tests I found that a normal working iPad storyboard starts working weirdly upon introducing auto-layout. In particular it seems not to properly pop-up dismissed views by always recycling the same view controller and to also badly handle the queue of instantiated view controllers. When I disable auto-layout everything works fine again. Does anyone know if this bug is known to Apple or there is a fix?
Not been able to complement the question with new information, I posted a new one at:
Triggering segues from annotations

How come my uitextfield(s) keeps being disabled after model?

I made an app for my wife to track inventory. it has a couple of view controllers to enter a new item, display all items, search items, and display selected item. After switching through each view a couple of times (no particular order) all of the textfields become disabled (you cannot select them to change the value) across ALL of the view controllers. The buttons still work however. I have it setup so that when the user enters info into a particular cell, it saves it into memory so that if they switch views and then come back, the cells will get the data in the viewdidload method. Please Help!
*edit - I am using storyboard with a bunch of segues (i'm new to programming and self taught, so idk if this is the right way or not)... here is a pic of my storyboard
http://i.imgur.com/aT3PR0i.png
Ok, with a look at your storyboard, I think I see your problem. If your storyboard looks like somebody spilled spaghetti on it, it's not designed correctly. Specifically, it looks like you're going "backwards" (to controllers you've already been to) using segues -- that's not good. SEGUES ALWAYS INSTANTIATE NEW CONTROLLERS! So, if you go around in a circle a few times, you're adding more and more controllers to your project. To go backwards using segues, you need to use an unwind segue -- it's the only one that is an exception to the rule that segues always instantiate new controllers. The other ways to go backwards, without segues, are popping with navigation controllers, and dismissing modal controllers.
I can't really diagnose your immediate problem without a lot more information, but redesigning the storyboard using unwind segues would probably fix your problem.

Using a view within a view causes crashes?

I am a learning developer that is always trying to learn new things. I am playing around with more advanced views and subviews, and am currently trying to use a view within a view. I know how to use modal views, but in this case I want both views to be present and running. So, picture the iPad running an unscaled iPhone app, that is basically the same idea of what I am trying to do. I can get the view to load up just fine, however, when I use buttons or anything inside the views that the user interacts with, the application crashes. It gives the following error message: EXC_BAD_ACCESS (Code=2, Address=0x17). What's weird is that there is no output from the debugger on this issue. I have tried to use a delegate (the way you do in a modal view) and it doesn't change anything. Any help is much appreciated :)
You can, of course, put many views inside a view.
EXC_BAD_ACCESS means you, or some object, is trying to access an object which has been deallocated.
I can mostly promise you that the issue is not because you are putting a view in a view, that statement and actually doing that is fine.
How you go about doing it, and how you handle everything is a different story.
You didn't provide any code or context as to where and how you are adding a view to a view, which is probably where the issue is arising. Enabling NSZombie as suggested by xlc0212 is a great idea to help diagnose the problem.
Hope this helps

Present modal view controller on top of Quick Look PreviewController results in checkerboard-screen?

Situation: my app needs to present a full screen modal view whenever it becomes active (from background) to ask the user for a PIN. All fine.
Unless: if the user previews a file using QLPreviewController, leaves the app and comes back, the PIN input controller will be presented modally from the QLPreviewController which I'm keeping a reference to. The PIN input is shown but when it dismisses, I see a checkerboard-styled background which is even scrollable. Seems to be some leftover of the PreviewController but the actual preview data is no longer shown. Any idea what could cause that?
Do I have to reload the contents of the preview somehow?
I had similar issue and I've managed to pin down the problem to either viewWillDisappear or viewDidDisappear methods. My solution was to subclass QLPreviewController and overwrite those methods with empty implementation i.e. skipping the call to super. I don't know if it's very safe, though I haven't encountered issues and it solved my problem.