Uiimageview not showing in iPhone 6 and 6 plus - ios

I have collection view with custom cell.
And in custom cell iPhone 6 and 6 plus Uiimageview is not showing.
But when i am printing the frame its there.
NSLog(#"%f-%f-%f-%f",cell._image.frame.origin.x,cell._image.frame.origin.y,cell._image.frame.size.width,cell._image.frame.size.height);
Log -
0.000000-0.000000-177.500000-168.000000
Cell Screenshot is -
Any suggestions what i am doing wrong...
Note - its working properly in iPad, iPhone 4,4s,5.

Have you checked to see if the image is even loaded. For iPhone 6 (vs the working ones) it is looking for a file/resource of name ImageName#2x.png
Its also possible your image view is setting alpha to zero (so image ends up just being white as background). You may have something like this that you need to comment out (or switch on phone type) :
- (void) setAlpha:(float)alpha {
// [super setAlpha:alpha];
}
Where is your image loaded from? Maybe show that code too. Maybe you have offsets that put the image off the display?

Related

iOS: Launch image gets wrinkled in the center during a call/recording/hot-spot session

I use a set of launch images for my app and noticed that when I'm having a call, recording a voice note or sharing my Internet connection and put that activity in the background and launch my app, the launch screen is wrinkled in the center. Is there anything I can do to make the image look ok or is it just a standard iOS behavior?
Just define a key in plist file will solve your problem
Status bar is initially hidden = YES
OK, the solution I found is to hide status when launching the app, just like here
Seems like Apple "take" 4% of screen space from the middle of the screen (as far as I tested) to give it to status bar. Personally I faced this problem when using iPhone modem mode.
So if it is not critical for image to be centered vertically - the solution would be to place image above/below this "4% middle screen area".
Examples when image is cropped:
How image should look(image centered vertically & horizontally, width & height are fixed size)
How it actually looks
Example when image looks as supposed to (but not centered) :
Constraints example
Image with new constraints example

Centering PickerIOS in React Native

I have been trying to center a PickerIOS, but I am probably missing the underlying logic behind a Picker, because I just want its width to be full screen.
I can manage to do that with iPhone 4s / 5s, but when I run it on the iPhone 6, the Picker seems to be on the left, with some space on the right side.
I have been trying to use alignItem:'center' with a wrapper around the picker, but that just makes it disappear. I have also tried alignSelf, but still doesn't work.
I thought that Picker, by default, had its width to full screen or does it adapt according to the length of the elements?
Do I have to place it in a Flexbox in order to get it centered with a full screen width?
mask1: {
height:120,
overflow:'hidden',
justifyContent:'space-around',
marginTop:50
}
I find out that the style of PickerIOSItem cannot change, and only works fine in NavigatorIOS. I review the example of UIExplorer and there is no more style binding to the Item. Maybe it's a bug.

How to make a developed app for iPhone5 to work on older iPhones (Screens) [duplicate]

This question already has answers here:
How to develop or migrate apps for iPhone 5 screen resolution?
(30 answers)
Closed 9 years ago.
I have an app developed and tested on my iPhone 5, but now I would like to make it work on older iphones as 4 and 4s. The functionalities work in the same way, but there are some buttons which do not appear because of the screen resolution.
Is there any way I can make the same .xib to work on different screen resolutions?
a) You can always design your interfaces (.xib) with anchor or elastic coordinates, so if the screen is bigger/smaller, the coordinates are relative to one of the edges of the screen.
b) You can WRAP the entire screen in a UIScrollView and let the user SCROLL to access all buttons.
These are the easiest. a) will give you more headaches. I would go for b) because it's more time efficient.
For b) I also recommend that you TRY the interface in a smaller screen and check that the hidden content is PARTIALLY VISIBLE, so users have a HINT that there's "something down there".
EDIT
This is an example for initializing a viewController with different xib files.
- (id)init
{
int model = ... //some model inspection method;
switch(model) {
case iphone3g:
return [self initWithNibName:#"iphone3g.xib" bundle:nil];
case iphone4:
case iphone4s:
return [self initWithNibName:#"iphone4x.xib" bundle:nil];
... //etc
I would suggest Apple's WWDC videos on auto layout, those will help with using the same XIB. It really depends on your interface and what you're looking to do, there's no one right answer.
You could also create two XIBs, one for 480 height and another for 568, then write in code a bit to ask the device what size it is, and load the appropriate XIB. This can be useful if auto layout just seems to be a big pain with what you're implementing.

Customize UIButton to make compatible to iPhone 5

I am working on my app to customize button accordingly. However once I change my button accordingly, now it has became irresponsive. You could see my code as follows. By the way, this button still works when I run on iPhone 4. It is really strange!
once I change my button position it works, but it wont work the position I want!
float screenSizeHeight=[UIScreen mainScreen].bounds.size.height;
if(screenSizeHeight==568)
[positionButton setFrame:CGRectMake(184,280,77,30)];
if(screenSizeHeight==480)
[positionButton setFrame:CGRectMake(184,240,77,30)];
Hand Bag button is not working!
Check your condition :
if(screenSizeHeight==568)
In both cases you have used screenSizeHeight == 568 so replace one with screenSizeHeight = 480
Hope it helps you.
Check your Default-568h.png image get added or not. If it isn't added , you mainscreen returns bounds as 320x480.
Note : 1) If you rotate device , check your main screen bounds. It may lead to confusion. You can try Better way to use it.
2) This Default-568h.png is only allowed when building an app using Xcode 4.5 and the iOS 6 SDK
3) When you ask a UIScreen for it's Bounds you get the bounds of the screen, which is the whole device screen. (the status bar is part of the screen)

iOS5: UIScrollView dispaying and scrolling differently from iOS4

This is a curious one.
I have an IBOutlet UIScrollView playScrollView whose height is exactly 1/3 of it's contentSize's height. The app is in landscape. I call this code...
[playScrollView scrollRectToVisible:CGRectMake(0.0f, page * PLAY_VIEW_PAGE_HEIGHT,
480.0, PLAY_VIEW_PAGE_HEIGHT)
animated:animated];
... (the int page ranges from 0 to 2) to start on page 1 (displaying the middle third) then go up or down as needed when the user presses buttons.
This works fine for iOS4 both device and simulator, and has been live on the app store for months with no problems. Even iOS5 devices are fine with existing builds, it was only when the app was recompiled for iOS5 that it stopped working correctly on iOS5 devices.
Since updating to XCode 4.2, This doesn't work for iOS5. It goes one page too low, showing the bottom page when it should show the middle. I can get the code to work for iOS5 (device and simulator) by changing page to (page-1)...
[playScrollView scrollRectToVisible:CGRectMake(0.0f, (page-1) * PLAY_VIEW_PAGE_HEIGHT,
480.0, PLAY_VIEW_PAGE_HEIGHT)
animated:animated];
...but of course this breaks iOS4, which works fine with the old code, but gets stuck one page too high with this new code. iOS4 and iOS5 are exactly PLAY_VIEW_PAGE_HEIGHT out-of-step (288 pixels, a third of the height of playScrollView). The same thing happens if I use setContentOffset: instead.
One other curious thing, probably the key to this. If I don't do the scrollRectToVisible at all, then iOS4 sits at the top of playScrollView, wheras iOS5 shows the middle third, (ie PLAY_VIEW_PAGE_HEIGHT pixels down).
I could detect the iOS and use different code for each, but that's a horrible kludge. If it's an iOS5 bug and they fix it in a future release, that would break the live app.
Has anyone any ideas, or noticed anything similar? Thanks.

Resources