UIButton image/backgroundimage scaling issues - ios

I have tried everything, so I finally decided to post this question. I have a button (well, quite a few actually) that holds an image, which was working fine, until my employer decided they were too small. First thing I did was get some new pictures, that were bigger, so the resolution wouldn't be bad. Now when I tried to "oversize" my button, at some point the image just didn't want to follow anymore and stopped scaling. I went searching on the internet, and saw that everybody was telling ppl to put their image as background image instead. I did that, but then a new problem raised: resolution was awful. So basically I have two question.
1. Is it really not possible to make a buttons image scaletofill; do you really have to work around by using background image.
2. Is there any reason that somebody else can think of why my resolution would be bad, as the picture I use is actually bigger than the background (and the proportions are correct). I originally had smaller pictures, but I deleted them from images assets and loaded in the new ones. I can't imagine Xcode somehow retaining a snapshot of the old pictures, but this makes no sense to me.
Any clearance on the subject greatly appreciated!

Try to remove app from simulator or device and clean Xcode build cache (Build->Clean)

Related

How to get iOS app to work on all iPhones? (Constraints)

I am fairly new to developing for iOS. I have a fully functioning program written in Swift and the UI was created in the scene builder on Xcode. I created an app for my work to simplify closing out the registers and other financial aspects. The app is complete and works perfectly, but was designed on the iPhoneX. The problem is that only a few of the employees have an iPhoneX, but they all have some kind of iPhone. I have tried setting up constraints but it never works. Ive tried scaling restraints and position restraints but I can't get the layout to look right on any other phone, and when I add the constraints it affects the view on the iPhoneX as well and doesn't look good on any iPhone. I need help getting this to work on all iPhones. I would like it to look and act the exact same regardless of the size of the phone, basically just scaled down. There are a lot of things on the screen and I can't figure out how to do this. Please help!!!
I have been working on this for a long time and I really need help. Please let me know if I need to clarify anything. I have posted links to some pictures of my UI so you have an idea of whats going on.
Constraints I tried adding, although I have played around with some other options.
Here's what it looks like on the iPhoneX, this is how I want it to look.
What it looks like on iPhoneSE (with constraints).
One thing I noticed in your Xcode project that none of your features are in UIView. Without it, it will be quite challenging and somewhat always different results. In theory, if you use AutoLayout features correctly it should work without UIView, but they make life so much easier. This is something I learned the hard way at the beginning of my iOS development. First set up your UIViews without any content inside it, give them some background colour to differentiate, once they are working on all devices. You can pin your features to superviews with no difficulty.
Since you have a repetitive features, you could also consider using Stack Views. You don't have complicated features, so as long as AutoLayout is set up correctly you should have no problems seeing it ok on all devices

Flash text disappearing when using draw method

Working on an AIR iOS app and noticed a strange thing.
In my app I have a navigation panel that displays over the main content-holding Sprite. Having this panel display was causing the app to crash on iPad1 (guessing too much memory). So I added a function to basically draw the content-holder Sprite (via BitmapData draw function) into a Sprite above it, and turn the content-holder visibility off. Basically, taking a screenshot.
However, I'm seeing on 2 different iPads now that any dynamically added text in the content-holder isn't being drawn. Sometimes, the first time it does, but not after.
One thing noticed is that turning off the cacheAsBitmap property of the text fields fixes the problem. Unfortunately, that is not an option as the app is very text heavy and the performance is noticeably slower if the dynamically generated text isn't bitmapped.
Any ideas on what may be going on?
Thanks in advance for any help.
-Mark
Looks like cacheAsBitmap on the dynamic text fields was the problem. By turning that off temporarily, taking the screenshot and then turning back on when done with screenshot, I was able to work around the issue.
Not sure if it's an AIR/iOS issue or maybe a lack of memory?
FYI, in case somebody sees similar problem. Hope that helps.

iOS apps image sizes

I am in the final stages of my app and after much research I can not find an answer to my question and I dont want my app to be bounced back for a silly thing...
I've buttons that are images within my app, I've read the apple guidelines and there is nothing around a preferred size of button images within the app. Do I've to provide 2 images one in low res and another in high ress of a button background image like a "bin" that would scale perfectly to higher ress just by stretching it?
Apple recommends at least 44x44 points for anything that can be touched by the user on iOS. You can find that information here: http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/Characteristics/Characteristics.html
Hope it helps! :)

iOS custom gallery

Sorry, I've asked a similar question but I'm already suffering 3 days dealing with a simple photo gallery in my app. I just need a gallery with array of 1024x768 images, a gallery that will fit pictures properly into the screen.
I've tried
ATPagingView - worked fine but an 1024x768 image couldn't be resized properly for both orientations.
MWPhotobrowser - didn't managed to connect because i'm using ARC, even if I disabled arc for added files, there was a compile error I coudn't get rid of.
Custom UIScrollView with pages, with a scrollView for each page and imageview inside it, but it didn't help.
Please, help me somehow, did somebody make galleries like that?
Give Nimbus a try. It is an open source framework that is run by jverkoey, ex Three20 guy. It is not ARC'd yet, but you can turn ARC off for compilation and that works just fine, plus they are moving to ARC soon, already have a git branch of it. It has a photoviewer class but I've not used it yet, but I will need to, that's only one of the reasons I'm using it. Pretty happy with it so far!
I already found KTPhotoBrowser classes. They are nice and well-documented. I implemented the very simple photo browsing gallery very fast. Images are now resized properly, everything is okay. if you want a gallery, try this, for sure!

iPad Limitations on Canvas Tag; Webpage Crashses on Canvas Tag Animation

Does anyone know if the iPad has any limitations on the canvas tag?
Currently I'm working on a creative that uses a flipbook and audio tag combination to simulate inline video content. The animations are drawn to the canvas element and synced with the audio content being played. There are 4 short video clips that get played when someone clicks on the four buttons below.
http://cs.sandbox.millennialmedia.com/~tkirchner/rich/K/kungfupanda2_test/
The problem I'm having though is in iPad. After playing a few animations, mobile safari just suddenly crashes. It never happens when I play it on my iPhone but it happens every time on the iPad. Its not one particular animation either because if I click a different combination of buttons, the previous clip that it crashed on plays fine, and then it decides to crash on another clip.
I think the problem might have to do with the amount of memory Safari gives individual page views. I found a blog post that explains that problem pretty well.
http://roblaplaca.com/blog/2010/05/05/ipad-safari-image-limit-workaround/
According to that post, once mobile Safari reaches a particular threshold of memory, images begin to return blank. This is consistant with my finds so far. The iPad that I'm testing this all on is running iOS 3.2.1 (and before anyone tells me that I should just explain to my boss that nobody uses 3.X anymore, I tried... they still want me to investigate this). I borrowed a co-workers iPad running iOS 4.2.1 and that device didn't crash, but some of the images weren't being drawn to the canvas.
I'm pretty sure its a problem with the canvas tag too, because I tried experimenting with running the animation without drawing anything to the canvas element, and the page never crashed.
Thats why I think maybe its a limitation with Safari's support of the canvas tag. Of course, I'm open to anybody else's suggestions.
Feels kinda weird answering my own question again, buuuut I figured if anyone did a search on this kind of question, an answer would be helpful.
I believe my original hypothesis was correct. The total amount of images that the aniamtions were using was around 600+. I think the older iPad loaded as many as it could and then when it ran out of cache and the canvas tag was trying to draw images that weren't really there anymore, it crashed.
Eventually we ended up serving the ad to devices with iOS 4.2 and higher, since the problem didn't seem to occur on those newer devices. Plus, we compressed the image sizes further, so that helped reduce the amount of images we were storing into memory.
If anybody knows approximately what the cache threshold in iOS 4.2 or higher browsers are, I'd appreciate it if you commented. Just want to get an idea of how many KB of image data I can safely load.

Resources