iPhone MapView gets removed - iphone

I have a tabBar in my application. In one of the section i have two views which i toggle between using segment buttons.
In one of the view i have MapView which i use to display list of users using their pic as annotation. On the other view i have tableView which shows the same users in table format.
Now everything is working fine, i am getting all the users and it displays fine on the map. It works perfectly most of the time on all device and all iOS but sometimes when i bring the mapView to front or toggle or try to zoom in. Both the views (tableView and mapView) just gets removed somehow and i see black screen (which is btw my superview so thats not a problem).
Does anyone know why this happens. It happens frequently on iPhone 3G the older iPhone.
Thanx for any help.

I've had the same problem. I think it's due to low memory to which your app responds by deallocating the tableView and mapView. My solution was to have both views allocated in viewDidLoad. I'm not 100% sure about this, but you could give it a try.

Related

iOS7 issue with container view

EDIT**: Although someone has decided they would like to down vote without a reason I'm going to leave this up. I noticed that in viewDidLoad of my view controller container, the content view I setup was the same size as in IB. When I later tried to load other views with my view container controller, the content view had changed it's bounds. Hope this helps anyone else that has a similar issue. The excepted answer worked. Since this is a build for iOS 6 a simple check of OS version made this an easy fix.
I have a strange issue that seems to be iOS7 related. This is an iOS6 targeted app. I have followed apples own docs about creating custom container views here. The problem I'm seeing in iOS7 is the first view I load is within the proper bounds of the content view i have defined, the other two are filling the bounds of the entire screen so it hides under the navigation bar with my segmented control. I defined the view I'm loading in a separate view controller in storyboards. Is there some sort of constraint that is working against me?
I should add that I have noticed the content view I defined in my container controller is actually changing it's size after the initial view is loaded. I'm at a loss of how to stop iOS7 from changing that UIViews frame size when it really shouldn't be changing.
Here are some screenshots. Code is pretty much the same as in the apple docs, have tried a few other ideas, defining bounds etc. but I think it has something to do with IB since the content view is changing its bounds. It appears to only be doing so in iOS7.
There is actually a proper way to fix this,
Set edgesForExtendedLayout to UIRectEdgeNone for the view under the tab bar.
Of course, I might've just looked at the pictures and assumed this was your problem...sorry if its completely unrelated..
That's a known 'issue' in iOS 7. Since you can now have a blurred look through the UINavigationBars, UITabBars, ... This also causes issues in native apps (e.g. the Photos App) or APIs.

UIActivityIndicator as UITableView footer shows different behavior in devices

AM using a UIActivityIndicator view as a UITableViewFooter, works fine in simulator, but shows different behavior in devices,think that occurs due to OS change.
Sometimes it fits to the width of the screen and seems enlarged, in other cases simply disappears, Any solution?
Found the reason myself, adding UIActivityIndicator as footer causes trouble in certain devices, so its better to use text like "Loading..."if you still need to show a footer.Else add an extra cell to UITableView and add UIActivityIndicator to that last cell.
In my case, the error was while testing in 3GS, no trouble in other devices.
Regards

display iPhone-View in a UIPopoverController on iPad (iPhone SDK)

i'm porting at the moment a iPhone-App to iPad.
I have to redesign some views but some views i want to present in iphone-size as popover.
Popovers are working well, but the content in the view in the popover has a wrong position.
There is a white border around the view an all UI-elements have a wrong position.
How can I make a correct position?
The problem was a missing target-membership of the NIB-Files to show.
I added the nibs to my ipad-Target and it worked.
But there is a new problem: It only work every second build.
Every second build there is the old error.
Have anyone an idea?

UIPickerView Causing Crash in iOS4

I have a simple tabbar app. Built directly from the tabbar template. As I test the app, I notice that the app sometimes crash. After pinpointing the right sequence, I found out that the app will crash if I do this:
Run app. Open the view that has a UIPickerView on it.
Open another view.
Tap home button (this will send the app to background).
Tap the app icon again to bring it at the front.
Tap the view that has the UIPickerView in it.
Crash!
Checking the console shows:
-[UIPickerView setFrame:]: invalid height value 130.0 pinned to 162.0
The UIPickerView I use is a custom size. I use transform of scale 0.8f on the height. So if you calculate 0.8*162.0 is indeed 129.9f (130 as mentioned by the console).
I have no idea how to fix this. Any ideas?
The problem is solved. It seems when the app goes to the background, UIPickerView needs to find its components resources again. It is not about sizing of UIPickerView at all.
I used images for the UIPickerView components, so after I populate the UIPickerView with these images, I released all the images that were allocated earlier. These images must not be released if it were to work in iOS4.
Only release them when the app ends.
Your problem has been fixed by another guy with a radical approach. See this post'sanswer provided by a guy named bhavinb.

UIScrollView app crashing in Device but running perfect in simulator

I am working on a photo gallery app. Root view is a navigation controller which takes the user to the thumbnail view. Tapping any thumbnail takes the user to PhotoView which shows the tapped image in full screen.
Below is what I have done in my PhotoViewController:
The approach is pretty much similar to the ScrollingMadness project which I found at github.
I initialize a UIScrollView and add it as a subView to my view controller's view. Set some basic properties of UIScrollView.
Add images to UIImageViews (5 in numbers).
Add all these imageViews as a subview to UIScrollView.
When zoom operation is performed on any image, all the image subviews but the current one are removed from the scroll view.
When the image zooms out back to the minimum scale, all the images are added back to the UIScrollView.
As explained in the sample code from Apple, I am using TapDetectingImageView delegate to create the imageViews and handling touch events.
When I run the app, everything works fine in simulator. No issues whatsoever. But when I run the app in device, it crashes after I scroll to 3rd or 4th image. While debugging I found out that didReceiveMemory warning is called after I scroll to 3rd or 4th image.
I run the app using Instruments. The object allocations shows allocation levels to only 1.5-2MB when the crash happens. I believe memory usage to this level is very normal ... right?
Anyone who experienced this before OR any input as to how I can get rid of it... would be all the help I need in world at this time.
Let me know in case you need any other info.
PS > Its frustrating to see the whole app perfect in simulator but crashing in the device :(
It is crashing because its running out of memory, one thing you should check is the size of the pictures, are you picking the image from the photo library w/o editing, sometimes this will give u images of resolution of 1600x1400 which will pretty much just crash the phone because it runs out of memory, for this you should just resize your images to smaller ones. Another problem that could be causing it is you are loading too many images at once (i dont think so though), if you are using t he scroll view to have a scrolling similar to the photo application on the Iphone then you should only need to load 3 images at a time. Also maybe you arent r eleasing the images properly when you are zooming . I dont know if you a re trying to accomplish a similar functionality to the scrolling of pictures in the photo app on iphone, if you are look at the sample project PageControl, they illustrate that pretty well there.