Image invisible in iPad because wrong Xcode folder management - ios

I have small problem. When I launch my app in emulator it works just fine, but when I launch it on my iPad I cant see the images of the buttons. The background is OK. Image 1.jpg is shown, but images in General folder like contour buttons is invisible on iPad. Other images like Glasses.png that in other screen are shown fine also. The image 1.jpg is defined via code:
- (void)viewDidLoad
{
[super viewDidLoad];
[mainImgae setImage:[UIImage imageNamed: #"Iview images/Bike/100/comp/1.jpg"]];
}
And other images for buttons selected via storyboard. I think my folder management is wrong, but i have to manage it in folders, so they will be in folders at my project folder.

[mainImgae setImage:[UIImage imageNamed: #"1.jpg"]];
this is enough for putting image for mainimage.,.

Related

iOS App Issue - Can't access image from image asset catalog

I'm new to iOS development, so apologies for advance. I know this has been covered earlier but I can't seem to find anything that helps with my issue.
Its a fairly simple but annoying issue.
I have a image in assets with a file name of hollwood.png but a xcode name, "hollywood" (no png).
I am trying to set a UIImageView to display it.
So in ViewDidLoad I have the following: (imageContainer is the UIImageView IBOutlet)
- (void)viewDidLoad {
super viewDidLoad];
self.model = [Model sharedModel];
self.imageContainer.image = [UIImage imageNamed:#"hollywood"];
}
I can not get it to display the image from Assets.
I know the UIImageView outlet works correctly because I can have the app choose a photo from gallery and set the photo to UIImageView.
I'm having a very difficult time figuring out how to load the image I saved in the assets catalog into UIImageView.
I just had this issue. I had dragged the image and for some reason Xcode added a weird "Design" locale and I couldn't load the image using UIImage(named: ). I don't know if this is your case, but you can try right clicking on the image in the Asset Catalog, "Show in Finder", opening the folder and checking the "Contents.json" file. Each image there should only have the keys "idiom", "filename" and "scale".
Make sure your image is added in Compile Sources
AppTarget->Build Phases-> Compile Sources
If not try to add that and check.

Watch app custom menu image not showing?

I am just creating watch app and adding custom menu image but it's not showing.
Got this guideline - Menu Image Guideline
And created the icon 80x80 in png format.
Naming it comment.png.
What am I doing wrong? Any help?
Edit 1- Added images in WatchAppImages.xcassets and now its looking like -
Are you calling setContextMenuOptions in your WKInterfaceController?
- (void) setContextMenuOptions
{
[self addMenuItemWithImageNamed:imageName title:title action:action];
}
And, where is the image added? should be in WatchAppImages.xcassets not in WatchExtensionImages.assets.
Also, your png should be name for retina display: iconImage#2x.png added in your assets in the blue square of the next image(in 2x, not for 1x or 3x):
Hope it helps.

Xcode 6: Images Not Showing Up On Device

I am creating UIImageView(s) and adding these views to a UIScrollView. The images show up when I am testing on a simulator, but when I test on an iphone 5s the images don't show up. Below is a list of things I have tried:
Clean Build
Reinstall App
Then I thought maybe it was a problem with retina images so I added retina images (the images are white pngs):
I am using the images as such:
UIButton *doneBttn = [UIButton buttonWithType:UIButtonTypeCustom];
[doneBttn setImage:[UIImage imageNamed:#"addButton.png"] forState:UIControlStateNormal];
[doneBttn setImage:[UIImage imageNamed:#"addButtonSelected.png"] forState:UIControlStateHighlighted];
[doneBttn setFrame:CGRectMake(0, 0, 50 , 30)];
[doneBttn addTarget:self action:#selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
[uiNavView addMenuBarButtonRight:doneBttn];
I know the code above works, because the image is displayed in the simulator.
What do I need to change to get the image to display on my device? Also, I have checked to make sure the files are in the xcode project directory, and not just linked.
I also faced this issue once, the cause of this issue was that I am not taking care of image name by assigning it to UIImageView, make sure that you are assigning UIImageView the exact name of the image as it is in the main bundle.
The simulator can read the image name if there is any case-sensitive issue or some extension issue like i.e. .png , .jpg, but device never reads the image name if there are issues in the naming conventions, device always treat the image name as exact.

setImage method of UIImageView not working sometimes

I have a UIImageView to show an image and a button to switch images from disk.
- (IBAction)loadNextImage:(id)sender {
if (m_currentPage >= m_pageCount - 1)
{
return;
}
m_currentPage++;
[self showImage:m_currentPage];
}
and the showImage method call the setImage method of UIImageVIew.
All this works well in simulator. But in my iphone4, for some certain images, it didn't show these images when I click the button to switch to these images. It still shows the last image. BUT When I make the app running in background and then switch it to foreground, the UI shows the image it should be!
I debuged it and the image parameter passed to setImage is not nil.
The image is about 200k. Is it too large? Is there anyone knows the reason?
Have you checked that the filenames match exactly what you are trying to load, i.e. image1.png is not the same as Image1.png as far as a device is concerned. But this will work in the simulator.

Why does the Images.xcassets not accept my jpegs?

I'm following along with Paul Hegarty on iTunesU and he adds jpegs to his project by selecting a group in finder and dropping them into the view associated with Images.xcassets. In my project that view has white icons called AppIcon and LaunchIcon. In the tutorial the jpegs are dropped and added, then a simple [UIImage imageNamed: ... can load them into the running program. But when I try to drop images onto the area, nothing happens.
I tried adding them to the project tree view on the left, and they were accepted there, but didn't get [UIImage imageNamed: to work.
Any idea what is wrong here?
TIA
Mark
There is no where such written that we have to use only png for assets catalog, but only I have seen at Create and Set iOS Launch Images they are saying for png, why don't you convert your jpg to png and give a shot.

Resources