UIImageview not showing image in whole app in device - ios

I am facing one serious issue in my app regarding UIImageview. It's not displaying images if i set from using UIImageView in xib but if i set it through code then it's getting displayed. And this issue is coming in Xcode 5.1.1 or above version of Xcode and in device. In simulator it's displaying all images perfectly.
Please help me solving this issue.
Any help will be appreciated.
Thanks.

hope this will help
if your image is shown in simulator(in all the condition through .xib or programmatically) and not in device , it might due to of case-sensitiveness
iPhone OS uses a case-sensitive file system, unlike the Simulator which uses a case-insensitive file system by default
for info:https://developer.apple.com/library/ios/qa/qa1697/_index.html

I also experienced the same problem and what I did is just deleted the UIImageview and reconfigured it and it worked. I think this is the problem with XCode new versions.

It's a problem/bug with Auto Layout constraints in iOS 7. If you remove the constraints on the UIView, it works no problem. You can set frames programmatically if you need to.

try this,
[youImageView setOpacity:1];
Actually "opacity" means "value of alpha-channel" of your UIView. When a view is fully opaque this means its alpha = 1, when a view is fully transparent (non-opaque) its alpha = 0.
As about properties of CALayer and UIView in Cocoa, they provide the same functionality.

Related

Autoresizing issue in Xcode 8

=== EDIT ========
This issue is now solved in Xcode 8.1. I have checked.
================
I don't know auto-layout properly. So, I am using autoresizing option in my all apps and it's fine for me. I am able to fulfill my all requirements by this without any issue.
Now in Xcode 8, I have migrated my old swift project to swift 3. Now issue arises.
See in image, I have set Autoresizing, and its working fine without issue in all devices until now and this project is live in AppStore, so that I can't show the UI or storyboard.
Now I have to do some update in project. So I am working in Xcode 8 now. But my autoresizing not working properly, as all the controls are come in center and UI is messed up.
And the issue persists in device also. I have checked in simulator and device as well. But problem is there also. Any suggestion and help will be appreciated. Thanks in advance.
EDIT:
Yesterday there is issue in runtime only, But Today storyboard also changed views like this image
Which means the whole UI design is messed up. This is weird.
Facing same issue. As a my point of view this problem is occurred when we use autoresizing and set only inner autoresizingMask to any view controller. Like,
If we use also boundary autoresizingMask at that time not facing this issue. Like,
I don't know this is actual bug of xcode 8 or remove this functionality in xcode 8.
So, Finally my suggestion is that we need to use auto layout in xcode 8.
Please try to uncheck autoresizing from xib or storyboard. And inviewDidLoad set [_scrollView setAutoresizesSubviews:YES];
Try it if this solve your problem
Edit: In case of storyboard uncheck Resize view from NIB option.
I'm not sure about storyboards but I've found a temporary solution for xib files. In Utilities panel (right hand panel) select File Inspector tab. Under Interface Builder Document section, select the file to open in "XCode 7.x". It will ask you to confirm that you do not want to use XCode 8 features, save the file and close it.
Xcode 8 beta 2 solved this problem!! I already checkeded now!
I had a similar issue for scrollView in Xcode8
I have an one solution to work with scrollView
First take a simple UIView and add all component which you want add to in scrollView and give that component to autoSizing
And also take one scrollView and programmatically set view frame and also set scrollView contentSize and add your view into scrollView
like wise, in my case I added this code in viewDidLoad for swift project
// add view to scrollview
self.scrollObjForNextAppointment.contentSize = CGSize(width:self.scrollObjForNextAppointment.frame.size.width,height:410)
self.viewForScrollContent.frame = CGRect(x:0,y:0,width:self.scrollObjForNextAppointment.frame.size.width,height:410)
self.scrollObjForNextAppointment.addSubview(self.viewForScrollContent)
it's work for me, Thanks!
Solved by unchecking "Auto Resize Subviews" to ScrollView
Update the issue seems to have been fixed in Xcode 8.1
Having the same issue and I've found that the offender here is the UIScrollView element. Just move everything outside of your scroller and you will see that everything works just fine, like before.
Which means one possible workaround would be to place your scrollable content in an ordinary UIView, then replacing it with UIScrollView at run time, programmatically.
A moderator kindly deleted my answer here as a duplicate, so see my answer at:
Autoresizing under iOS 10 doesn't work
In response to max, yes, resizing a bunch of subviews can be a pain. That's why I suggested adding a single "content view" to the scroll view and moving all of your existing subviews inside of that view. Autosize the subviews inside of the content view just as you did with the scrollview, and autosize the content view to the scrollview.
It's that content view that you're then resizing inside viewDidLayoutSubviews.
And again, the "content view" inside of the scrollview construct is pretty much the standard way to get auto-sizing scroll views using autolayout, so it should be considered a best practice.
That method is described here...
https://spin.atomicobject.com/2014/03/05/uiscrollview-autolayout-ios/
My method seems a little convoluted, but I was able to patch up a storyboard with about a dozen scenes and Vc's in about 15 minutes. It would have taken much, much, much longer to rebuild everything using auto layout.
Apple just came out with XCode 8.2, which fixes this problem for me. I have been using XCode 7.3.1 for my interface design parallel to 8.1, but I can now use 8.2 without any problems.
The storyboard gets updated with widths and height of frames though, to accommodate the new 'View as:' functionality. Though it doesn't seem to affect running on device/simulator.
Curiously, the bugfix it is not noted in the XCode 8.2 release notes.
Original answer here

Can't see UITextFields UIButton etc Xcode 6.1.1

I created a project (i believe before i update to Xcode 6). Now when i look at storyboard none of my Obects/Outlets (UITextfields/UILabels/UIButtons) are visible, they are still there and appear when i run in simulator.
Has anyone come across this and have any ideas?
Thanks in advance
may be you need to need to re-size the view controller because its default have a universal view so you have to set the size to view-controller for only Iphone.
hope it will work

In xcode 6.1, interface builder deleting ui elements

I have a view with some tableviews and some collection views and also some buttons and labels.
I'm not sure if this is new with Xcode 6.1 because I have not worked on the ui aspect of this project for some time. However, when I try to resize just about anything in the view, my tableviews and collection views, and possibly some other elements I am not noticing, get deleted. Specifically, it seems their frame or rect propertied get deleted.
To be clear, this only occurs when I attempt to resize the element by dragging the sides in interface builder. If I resize them by changing the numbers directly either in the IB sidebar or in the xml, this does not happen.
I'm wondering if this is a bug in Xcode or if I have done something to cause this behavior which I can change.
Thanks!
I acheived a fix, at least for this project by turning off auto layout in "show the file inspector" -> "interface builder document"
I have never used this feature in the past so I do not know if it was on in the past but I am wondering if the new Xcode version turns it on by default where the others left it off.
It may also be possible that it has always been on but there is a bug in the feature in the new version.
This fixed the issue for me, at least in this particular project and at least for now. I hope others find this useful.
From here it looks like a bug in Xcode 6.1.
I created a clean project and the behaviour is the same on my machine:
https://github.com/nasht/Xcode6ConstraintTest.git
Resizing one view makes others disappear. Changing a layout constraint from a = to <= or >= also seems to do it.
I've raised a bug with Apple. Suggest you do the same.
workaround: You can install xcode 6.01 and use interface builder from there. You can still compile and run your code using xcode 6.1 if you're relying on xcode 6.1 specific features. (you'll need to rename your xcode.app so you can run both instances. ) It's ugly, but it works.
I found that it's fixed on the next version of xcode (6.1.1)
same problem, yosemit and xocde 6.1. I can resize some view only if i disable autolayout.
I think I ran into this 'problem'. I believe this was because one of the constraints I had was not setup correctly.
What OS X Version are you on? I updated to Yosemite today and 6.1 along with it. When I would resize a label my other elements were not getting deleted but instead getting resized and repositioned. The width / height would change to 0,0 and the x / y would change to 0,0 as well.
I was noticing other issues with Yosemite so went ahead and did a time capsule restore back to Mavericks and Xcode 6.0
I had the same problem in universal app; iphone works fine and the ipad doesnt work.
I'm using xCode 6.1 and OSX Yosemite
My app supports iOS7 and iOS8 and i had the same problem on iOS7 on iPad version only
Fix:
So i fixed it by setting Simulated Metrics in interface builder by
Size = iPad Full Screen and Orientation by Landscape or Portrait
I have got the same kind of problem with Xcode 6.1 and Yosemite :
I have created a view that I have added to the main view, so it appears like a sub view in the View Controller Scene.
Then I resize this subview to 320 x 568. My program works. It corresponds to the program dropit of Stanford CS193P Lecture 9.
I save the project, close it and reopen it : the subview has its width and height set to 0 !
I tried to open the project dropit of Lecture 8 that is quite the same, which was working before (I think in Xcode 6) and same problem ! First I thought that tapping (related to the subview) was not working but found out that tapping was not working because I was tapping on a subview which has its width and height set to 0 !
I have reset the size class wCompact hAny to which all the UIElements are added. and got corrected.

UIDatePicker Cutting Off Text & Not Displaying Days

My app is suddenly unable to correctly display UIDatePickers. I'm using storyboards. The Datepickers are set to just display the date. They are cutting off the month, and also not even showing the days. There's a big space in the middle. I have tried cleaning the project, resetting the simulator, checking localization settings, and checking to see if dynamic type size was set. I'm using Xcode 5.1.1 but the same thing happens in the beta of Xcode 6. Any suggestions would be appreciated.
Ok, I figured it out. This happened as a result of trying to use UIAppearance on a tableView background color. This has nothing to do with tableViews on the face of it, but Apple must be using a tableView privately for the PickerViews. So, my attempt to set a UIAppearance via a category on a tableView background color seems to be doing something unexpected. Lesson learned. Don't try to use UIAppearance where they are not officially supported.
I had this exact same issue, and it was related to duplicate constraints in my storyboard. I'd been implementing iPhone 6 widths and inadvertently ended up with both width = 320 and width >= 320. Removing that width = 320 fixed it instantly.

Positioning issue with IOS7

Create UITabbarController with xib for 5.0, which worked fine.
But when app is installed in 4-inch device, tabbar item is misplaced. Attached screenshot.
How this can be fixed. Am using UITabbarController in xib
Thanks in advance,
I faced the same issue with UIBarButton, it only happens with System icons in my case, using custom icons worked fine.
I couldn't find a proper solution, but subclassing the object and changing the frame position of the image after the fact seems to work.
I'll update this if I find a solution that works consistently.
related post:
iOS UIBarButtonItem allignments

Resources