UIActivityIndicator as UITableView footer shows different behavior in devices - iphone

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

Related

UIButton images look fine in IB but get stretched when displayed on app

I'm developing an Enterprise app for tracking mileage and maintenance for company vehicles. I've added graphic buttons to snazz it up a bit. The buttons look the way they're supposed to look on the XIB in IB, and on the iPhone all other UIViews look correct, but on one particular UIView the graphic images are stretched way out of proportion vertically.
The first image below shows how it's supposed to look, with the three graphics buttons at the bottom. The second image shows how it's showing on the phone. The Help button on this screen cap shows normally, but it can't be counted on to stay that way.
It also is not consistent. Calling this view at any time may show the image stretched or it may not show an image at all. It rarely shows the image normally, like the Help button looks below.
The development phone is a 4S running 6.1.3. The views are set for the Retina 3.5 screen. XCode is the latest (whatever it is).
Again, it's only on this one view that the problem shows up. There is another UIView on the same view controller that is hidden when this UIView is shown. The button graphics on the other view look fine. All of the other views and view controllers use the same graphics on the UIButton, without any problem.
In Interface Builder (Xcode) you created the view using a 4.5-inch screen height.
But the device where you are seeing the problem is a 5-inch screen. So the view is resized to fit.
And when it does that, the autolayout constraints that Interface Builder put on those subviews take over to determine what they do. Those constraints are causing the heights to change.
No need to turn Autolayout off. Autolayout can be very useful, but it seems to enjoy randomly assigning the constraint "Align Baseline to:" to UIButtons after repositioning them.
Just select the UIButton/UIImageView in question inside Storyboard, locate the constraint "Align Baseline to:", tap the gear icon and select "Promote to User Constraint", and tap once more and select "Delete". This should solve your issue.
In response to the comments here, I will answer my own question: I turned Autolayout off for this view controller, and that fixed everything. This is the first app I have written since XCode has begun development for the iPhone 5, so I wasn't aware of the Autolayout feature. I'll need to understand how it works and why it did what it did.
Thanks for all your help!

Label of UIButton appears intermittently inside a UITableView

I have a UITableView with some data. One of controls is a UIButton, with a label assigned. So, in rare cases, when I push the UITableView screen, the buttons appears without label. After I scroll the UITableView or rotate the device, the label appears.
I put a NSLog entry inside the drawRect method. And It's not called in some cases.
Some advices?
Thanks
i found same problems that some methods rarely not called. make sure delegate is properly set and then check the result
After analyzing my code I saw some characteristic that caused the problem. The process of construction of my screen was occurring in a different thread of the events thread. So, I fixed this and everything is fine now.
Thanks.

iPhone: app crashing when scrolling UITableView up to 60+ custom cells

I have search the web many times for the same question and also got many relavent answers but none of them resolved my problem.
Here is the problem: I am having a UITableView with UISearchBar on its top.As the users searches for particular word,the UITableView is filled with custom cells.
It works fine in the simulator.The problem is with the device,I mean iPad.
Now when the tableview is having almost 40-50 cells,it works fine even when the user scrolls. But if the tableView contains 60+ cells and user scrolls to,say 55 onwards,app crashes without giving any error. I have set NSZoombie Enabled. I have already debugged the app many times but no results.
profile your app and see if you use too much memory or not.
also you can see memory warnings from applicationDidReceiveMemoryWarning method of your appdelegate, just implement it and put a breakpoint to the entrance.
if there is a problem with reusing of the cells, you might be allocating too much cells and exceeding the memory limits.

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.

iPhone MapView gets removed

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.