UITableView Reloads on iPhone but not iPad - ios

I have some weird behavior differences running my app on an iPhone and iPad I am trying to understand.
I have the following method to reload a UITableView when a user starts to edit a text field. It works 100% correctly on my iPhone, however when I load the app onto my iPad, the table does not reloadData when this function is called. I can see that the textFieldDidBeginEditing: function is called (and all code inside it) however the table does not reloadData: when the app is run on my iPad.
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
self.concatLabel.hidden = false;
NSLog(#"BEGIN EDITING");
self.messageField.text = nil;
self.concatLabel.text = nil;
[self.arySelectionState removeAllObjects];
[self.tableView reloadData];
}
My iPhone is running iOS 8.1, while my iPad is running iOS 7.0
My deployment target is set to 7.0. I switched the Deployment target device from iPhone to Universal and I have the same issue.
I would appreciate any insight or advice.

Related

iOS 7 issue with autolayout

In the app I support iOS 7+. But I can't download a simulator to test it on iOS 7, because the latest simulator available is iOS 8. Everything works fine on iOS 8 and iOS 9. But my customer has iPhone 4 with iOS 7 and when he runs the app, it crashes immediately after launch with error:
Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super
I took this error from crashlitics report. May be somebody knows how to correct that?
Check your all layoutSubviews methods where you have write and in that method first call [super layoutSubviews]; .
because before few month I have same problem for ios 7 and then I call [super layoutSubviews]; In custom cell where I have used layoutSubviews method and its working fine for me.
-(void)layoutSubviews
{
[super layoutSubviews];
// do your stuff
}

Disable some classes when building on ios6 [duplicate]

Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.
Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.
For handling the StatusbarStyle I am using the following methods in IOS7
1. [self setNeedsStatusBarAppearanceUpdate];
2.-(UIStatusBarStyle)preferredStatusBarStyle;
These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.
So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.
Even I used few methods to resolve this crash issue.The methods which I used are
1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000
Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.
So please help me to resolve this issue. Thanks in Advance.
use NSFoundationVersionNumber condition for doing this Supporting iOS 6
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your Info.plist file—
you can use the version of the Foundation framework to determine the current system version and load the appropriate resource in application:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
Take a look the best answer of the same thing that you want
iOS 7 status bar back to iOS 6 default style in iPhone app?
Try checking for this condition :
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
} else {
// iOS 6
}

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
}

How to execute a block of code in IOS7 not in IOS6?

Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.
Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.
For handling the StatusbarStyle I am using the following methods in IOS7
1. [self setNeedsStatusBarAppearanceUpdate];
2.-(UIStatusBarStyle)preferredStatusBarStyle;
These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.
So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.
Even I used few methods to resolve this crash issue.The methods which I used are
1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000
Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.
So please help me to resolve this issue. Thanks in Advance.
use NSFoundationVersionNumber condition for doing this Supporting iOS 6
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your Info.plist file—
you can use the version of the Foundation framework to determine the current system version and load the appropriate resource in application:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
Take a look the best answer of the same thing that you want
iOS 7 status bar back to iOS 6 default style in iPhone app?
Try checking for this condition :
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
} else {
// iOS 6
}

detailTextLabel.text not showing, on iPhone 5 only

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];

Resources