iOS 8 issues in showing UIView - ios

I have a custom UIView in my application which was working correctly in iOS 7.1 but after upgrading the device to iOS 8, i start having issues with Showing it.
1) Orientation issues
2) On keyboard show issues
Screenshots from iOS 7
How Custom UIView appear on iOS 8
Here's the code sample:
1) Calling the custom UIView
CustomIOS7AlertView *alertViewiOS7 = [[CustomIOS7AlertView alloc] init:NULL];
[alertViewiOS7 setContainerView:[self Calculator_Create]];
[alertViewiOS7 setButtonTitles:[NSMutableArray arrayWithObjects:languageSelectedStringForKey(dataObj.languageBundle, #"Close"), languageSelectedStringForKey(dataObj.languageBundle, #"Add"), nil]];
[alertViewiOS7 setUseMotionEffects:true];
[alertViewiOS7 show];
2) CustomIOS7AlertVIew class Code
https://drive.google.com/folderview?id=0B-EraWQtN1hNfmtoUXZHLXNPREdrU1QwVkdwTDNCWDhHYXk5X3hNSjdOQ3FZM3k4T0hyZUk&usp=sharing

Use UIAlertController because UIAlertView has been deprecated in iOS 8.

Related

OSM works on my iPhone but doesn't work at another

I run OpenStreetMap in my app:
NSString *template = #"http://tile.openstreetmap.org/{z}/{x}/{y}.png";
MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
overlay.canReplaceMapContent = YES;
[self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];
It works perfect in my iPhone with iOS 8.3, and customer before update iOS til 9.0 didn't say anything. But now, customer says hi has only grid instead map. Hi has iOS 9 now.
What changed? What should i add in my code?
HTTP, by default, is not supported in iOS 9, so your initWithURLTemplate call is failing. When the MKTileOverlay goes online to fetch a tile, it can't do it. Thus, no map appears.

preferredContentSize not working in ios 7?

I am using modalPresentationStyle of type UIModalPresentationFormSheet to show my view.I want specific size of the view so using preferredContentSize which working in iOS 8 and showing exact how I wanted but same breaks for iOS 7 it's come as full sheet.View size changed.
Where as I wanted like below image
Any idea?
Please check below conditional code for iOS 8.x and iOS 7
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(#"8.0"))
{
modalController.preferredContentSize = CGSizeMake(frameSize.x, frameSize.y);
}
else
{
modalController.view.superview.frame = CGRectMake((screenWidth - frameSize.x)/2, (screenHeight - frameSize.y)/2, frameSize.x, frameSize.y);
}
Hope this will help you.

EXC_BAD_ACCESS when retrieving views from transition context on iPhone 4

I have the following code, which works perfectly on my iPhone 5 and all the iPhone simulators, but it crashes on my iPhone 4. I get EXC_BAD_ACCESS on the last line where I pass UITransitionContextToViewKey to my transition context.
I have a clean analyze and build, and the same happens for both UITransitionContextFromViewKey and UITransitionContextToViewKey.
My iPhone 4 is on iOS 7.1.2, my deployment target is 7.0, targeted build base SDK 8.0.
Anyone knows what to do here? thx.
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
// get transition parameters from context
UIView *containerView = transitionContext.containerView;
UIViewController *destinationViewController =
[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
if ([destinationViewController.title isEqualToString:#"ListController"]) {
// get source and destination views
UIView *sourceViewSnapshot = [self.view snapshotViewAfterScreenUpdates:YES];
UIView *destinationView = [transitionContext viewForKey:UITransitionContextToViewKey]; // EXC_BAD_ACCESS
// ...
}
The viewForKey method is iOS 8 and up, but the viewControllerForKey method is supported in iOS 7. A small change to your code gets the view in iOS 7:
UIView *destinationView = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey].view;
From the documentation:
UITransitionContextToViewKey
Available in iOS 8.0 and later.
You can't run that code on iOS 7
You might want to add runtime system version checks and branch out to a iOS 7 compatible code at this point if you want to maintain compatibility with this version of the system

UIImageView disappear in iOS 7 but presented well in iOS 6

So strange since some of the photos not displayed in iOS 7 but displayed well in iOS 6.
I've both normal & #2x & -568#2x.
It happens with IBOutlet UIImageView and also when I subclass UIAlertView.
For example:
EDIT:
alert = [[UIAlertTrapAlarm alloc] initWithCameraType:camType andFrame:[UIScreen mainScreen].bounds];
[[NSNotificationCenter defaultCenter] postNotificationName:CreateDistance object:nil userInfo:dictionary];
[alert addButtonWithTitle:NSLocalizedString(#"not_exists", nil)];
[alert addButtonWithTitle:NSLocalizedString(#"exists", nil)];
[alert show];
[alert changeMessageBox:distance description:trapDesc type:trapTypeString];
[alert showHideExistsNotExistsButtons:camType];
[alert showHideButtons];
// alert.imageViewBackground.image = [UIImage imageNamed:#"allert1"];
[alert.imageViewBackground setImage:[UIImage imageNamed:#"allert1.png"]];
[alert setNeedsDisplay];
[alert.screenView setNeedsDisplay];
I forgot to mention all subviews in my subclass UIAlertView not showing.
Well you can check your Interface builder if you use Xcode 5 , there is option for viewing your Xib as 7.0 to later or 6.0 to earlier like this. See if your UIImageView is at correct place when you see it as iOS 7.0 to later. If you can't see your UIImageView then my answer might help.
I have had this problem few days ago , when I switch between iOS 6 to iOS 7 then some views became invisible and Interface builder showed garbage values at attribute inspector , like position (-680 , 675 ) , W/H (0,0) something like this. I solved this problem by unchecking AutoResizing masks of right and bottom. That solved my issue.
You can try if your problem is something similar. Because without more detail information about your codes and others , it's hard to give you a exact solution.
From that one line of code my guess is that your setting the background image in code while you set the foreground image in Interface Builder.
Try using
alert.image = [UIImage imageNamed:#"allert1"];

UITableView background View nil doesn't work in iOS 5

I need to make my grouped UITableView backgroundColor transparent.
So i write following code. That is work in iOS 6. But in iOS 5, it doesn't work.
self.tbView.backgroundView = nil;
How to do that in iOS 5.
Are you setting [self.tbView setBackgroundColor:[UIColor clearColor]];?
If not, you need to add that or you won't get a transparent backgorund color.
You Need to put background Nil code into ViewDidLoad this is working fine in my Code. Hope this Helps you.
[tbl_My_Table setBackgroundView:nil];
[tbl_My_Table setBackgroundView:[[[UIView alloc] init] autorelease]];
I got it answer.
We need to add two lines of codes for both iOS 6 and iOS 5.
Here is codes.
self.tblPreferences.backgroundView = nil;
self.myTable.backgroundColor = [UIColor clearColor];
That is working both iOS 5 and 6.

Resources