Some UI elements are unable to tap/click in iOS simulator - ios

I build an table that can choose multiple cells.
But when run it in iPhone 8 Plus simulator, the cells are often unable to click, then I should return to previous page and go back to the table, make it work(usually should return and go back several times).
But sometime it does work normally.
iPhone X simulator also has this problem, but seems not so frequently.
Pic of the table view
What's the cause and solution? Thanks

ios Version? try ios 10
if (#available(iOS 11.0, *)) {
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}else {
self.automaticallyAdjustsScrollViewInsets = NO;
}

Related

Old app to support for iPhone X?

My old iOS app works well in all iPhone versions(Except iPhone X model). I run into iPhone X simulator and seeing some of the screens gets overlapped at bottom of iPhone X screen. My apps all uiviewcontrollers created programmatically, not designed by story board. So in all view controllers I used (self.view.frame) to find its frame size. In iPhoneX there is safe guard area to design in story board. But how do I calculate safe guard area in runtime. While searching google it gives some sample to find safe guard area which is support from iOS11.. But I want to run my app from ios9? I have lot of uiviewcontrollers in my project .. So can anyone tell me an easiest way to do this task?
One possible way to add a run-time fix for iPhone X layout issues to old (pre-storyboard manual layout) apps (with old pre-11 Deployment targets), is to add Objective C code similar to:
CGRect r0 = self.view.frame;
CGRect r1 = r0;
if (#available(iOS 11.0, *)) {
r1 = self.view.safeAreaLayoutGuide.layoutFrame;
}
if ( r1.size.height < (r0.size.height - 20.0) ) {
// fix top and bottom view overlap outside safe area here
}
inside each UIViewController's viewWillLayoutSubviews method.
The #available check will make this code safe to use under iOS versions prior to iOS 11.

iOS 11 20 points gap over tableview in UITableViewController with static cells

I have been using a UITableViewController in my app. It worked fine in iOS 10.x.x but I recently upgraded my Xcode and iOS to (Xcode 9 and iOS 11). Then the my app is having this UI issue. It will show a 20 points gap above the UITableView in a UITableViewController with static cells. Anyone having same problem and found the solution for this?
It is due to the new property introduced in iOS 11. Try the following:
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
} else {
automaticallyAdjustsScrollViewInsets = false
}
chengsam's answer works perfectly to solve this problem.
If you want to accomplish the iOS 11 part in Interface Builder, you can do so. It's available in the Size Selector in the Utilities View.

Textfields in Tableview behave differently on iOS 9 and iOS10

My TableViewController uses auto-drawing custom cells with textfields and segmented controls. The textfields are selectable on iOS 10 and 11, and the keyboard pops up automatically. However, on iOS 9, the textfields returns no response upon tap, nor do the segmented controls. The app isn't frozen though, as everything else works just fine.
I'm using Xcode 9 and Swift 3.2. There's no error message from the console when textfields aren't responding on iOS 9.
the same thing happened to me... and the solution is..
select simulator.
go to hardware>>keyboard
then select all three opions and after that unselect those all.
thats it!!!
i thik this is the bug of simulator... but thats fix my problem.

UITableView Reloads on iPhone but not iPad

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.

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
}

Resources