detailTextLabel.text not showing, on iPhone 5 only - ios

I've solved this but it's worth sharing as I couldn't find anything on this.
I had a subclass of UITableView, with a detailTextLabel.text that was not displaying. The detailTextLabel object itself exists as normal, and contains the text, you just can't see it on the screen.
The bug only happens on the iPhone 5 or retina 4 inch simulator. It's fine on the iPod 4 or any other simulator "Hardware". The iOS version used makes no difference.
Answer is below.

Fixed it by having the view controller that triggered the display of the offending table do so in viewWillAppear instead of viewDidLoad.
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//Used to do this in viewDidLoad, but that stopped the detailTextLabel showing
//for this table view on the iPhone 5. If do it from here, it's fine.
[friendsSubView addSubview:friendsTableViewController.view];
}

Should following be the right code?
[friendsSubView addSubview:friendsTableViewController.tableView];

Related

Simulator IPad pro (works) vs iPhone 6 plus

I have my mobile app in Objective C.
I have a scroll view page. In Simulator iPad Pro it works.
In Simulator iPhone 6 Plus, the scroll view starts at lower part of
page and I cannot get it back up to top. In fact all of
the iPhone ( 5,6,7) look like the iPhone 6 plus.ie the top of
the page shows "Grade" and "County". I cannot scroll up to see
"First Name". The only thing I am changing is the device.
Suggestions?
below is iPhone 6 Plus
SOLVED- During trying all several options, I
forgot I had:
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
// REMOVE the LINES BELOW
[self.scroller layoutIfNeeded];
self.scroller.contentSize = self.contentView.bounds.size;
self.contentView.center = self.view.superview.center;
}
After removing the 3 lines above, it worked correctly in iPhone 5, 6, 7.
The IPad worked WITH or WITHOUT those 3 lines.
I spent a lot of time on this. I hope this helps others.
are you using Constraints to setup your views? if so then try checking scrollview's top constraint whether its linked to Top Layout Guide's bottom ?

Wrong width of view on startup of iPad app in iOS 7

If your device (simulator or iPad) is in landscape orientation and you start the app while querying the width you get wrong results. One should get 1024 but in fact I'm getting 768 which is completely wrong. On iOS 8 this does work as expected. On iPhone and iOS 7 the view is first in portrait but then changes quickly to landscape which works for my case.
In viewDidLoad I'm getting the the size with View.Bounds.Size.Width. If you rotate the device and query the data in didRotateFromInterfaceOrientation the data is correct. For my app I don't need this in viewDidLoad, but in another method. But in viewDidLoad it seems to be the same behavior.
What's wrong here? How do I get the correct width of the view on iOS 7 and iOS 8?
You should try getting the width in viewDidLayoutSubviews: or any other method that comes after that in the view hierarchy such as viewDidAppear:
Hope this helps you.

Renewed xib with Size Classes not showing iAds in iPhone 6 and iPhone 6 Plus

I need to update my old application to support iPhone 6 and iPhone 6 Plus devices. After few changes and adding images with #3x size all interface looks good now, but I have noticed that when I check "Use Size Classes" inside the xib file I can no longer see iAds in iPhone 6 and iPhone 6 Plus. All other devices shows ads normally. For testing I'm just using simple line of code to support ads:
self.canDisplayBannerAds = YES;
Inside the xib file I have only navigation bar, date time picker and few labels. There are no visible elements that can hide banner. I had also other VController with xib file, but I've changed it to the controller without xib with programmatically implemented view elements, so it shows ads now.
Interstitial ads loads without problems in all view controllers. Does anybody had the same problem and knows how to solve it?
I found the solution by myself. When using xib file and using
self.canDisplayBannerAds = YES;
in my situation I moved this command from viewDidLoad to viewDidAppear and banner showed up. Now I can see banners in all devices.

Button Images Don't Show When Using Xcode 5

I have several buttons with images assigned to each. In Xcode 4.6 using the iOS 6 SDK, they show like they should. When using Xcode 5 with the iOS 7 SDK, the images are not there. In the xib it says an image is on the button but it doesn't appear. Any ideas why?
iOS 6:
iOS 7:
For me, my problem was that the button type was set to System instead of Custom. They displayed fine in iOS 6.0 and iOS 6.1 Simulators, just not iOS 7.0 simulator. I'm not sure how this happened as I'm pretty sure it's the first time the project had been opened in Xcode 5 with iOS 7.0 sdk. I had three buttons, 1 showed fine because it was a Custom button, and the other two did not show their images, but could be pressed. Once set to Custom button types, all worked great, as expected.
I was able to get the images to appear after setting the tint color to clear and setting the image and background image to what I wanted. In Xcode 4 I didn't have to change any of that and I didn't have to set the background image, just the image.
yes it is iOS7 issue.
Set bottom margin of the image/label through autolayout then try this code in your viewDidLoad and this should work.
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)])
{
[self prefersStatusBarHidden];
[self performSelector:#selector(setNeedsStatusBarAppearanceUpdate)];
}
else
{
// iOS 6
}

iPhone 5 app displaying correctly but not sensing touches in "extra" space

I "converted" my app to be iPhone 5 compatible by adding the Default-568h#2x.png startup image and all appeared to be working fine. The app is a simple Navigation Controller app which starts with a UITableView.
By "appears to be working", I mean that the initial UITableView displays fine on the iPhone 5, occupying the entire screen properly. However, the view doesn't respond to touch events in the bottom 176 pixels, exactly the "new" area for the iPhone 5.
In the annotated screenshot below, the red area doesn't respond to touch events. The problem occurs on all the views of my app. At first I thought it was a simulator bug, but I've tested on an iPhone 5 and the problem is the same. Also, this particular app is the only one that has this issue.
I suspect it has something to do with the fact that the app was first created a long time ago (around the time of iOS 3.x), and that there's something in those old NIB files which is messing things up.
I've tried changing the view sizes and autoresizing masks but nothing makes any difference, and it's driving me crazy!
Just add this line in your applicationDidFinishLaunching: method, it should solve your problem:
window.frame = [[UIScreen mainScreen] bounds];
Alternatively, you can enable the Full Screen at Launch checkbox of your window under the Attributes Inspector of the xib file.

Resources