UILabel text on iPad not resizing - iphone

I have iOS 4.3 installed on my iPad. I'm noticing that my text in my UILabels is not resizing. In other words, I'm adding letters, but it's just truncating. Same settings work find on iPhone also running 4.3. I'm perplexed. I've made certain that "Adjust to fit" is checked on the label properties. I've even set it in the code with .adjustsFontSizeToFitWidth and even tried calling sizeToFit.
None of these let the text resize.
Does anyone else have this problem?
Any ideas?
My next solution is going to use this: Check if label is truncated to try and manually resize the label text.

I finally figured it out. I'm using OHAttributedLabel. I had intended to do some things with color in my labels and have not yet gotten around to it. It finally dawned on me that was the only difference from previous iPad versions and from the iPhone version (I never even thought to look at the class). Turns out this OHAttributedLabel class does not support resizing yet.
Sorry for wasting everyones time. Maybe someone else will someday find this useful.

Try using CGSize eLabelSize = [yourLabel.text sizeWithFont:yourLabel.font]; to get the size of the label and then you can simply modify the yourLabel.frame.size property with eLabelSize.
This worked for me in case of iPhone.
Hope this works for you if yes do communicate..... :)

Maybe it only appears as if the label is truncating text because the label frame runs out of the bounds of its parent view, which clips to its bounds? Verify the frame of the label and the autoresizing mask.
Also, the minimumFontSize property is set low enough?

Related

Some Border Types in NSImageView Not Appearing

I've looked in previous posts in SO and elsewhere for an answer but no luck. I'm putting images in an NSCollectionView as well as just a single image itself but the only border that seems to work is the grey Bezel border. Other types that are available don't show up, like Button or Groove. This is true no matter what scaling option I use, or even if I use it in code. I'm using NSImageView.imageFrameStyle.
I hope someone has some insight into this. I didn't provide any code since I didn't think that's necessary. Using Xcode 10.1, Swift 4.2. Thanks for any help.

How can I prevent Xcode from changing the color of my buttons?

So I've done a button for my iPad app, and I saw something strange. When I run my app in the iOS 5 simulator, it changes the color, and the lines of my button become discontinuous. But when I push it, the button comes back to the right color, and the lines are ok. I think it's something that Xcode does automatically with any button, and I don't find the way to cancel it. Thank you for helping!
PS: The button code is so simple:
IBOutlet UIButton *button;
This is what it should look like:
And this is how it looks in the simulator:
Both tams and JacobFennell have good points, but you should also note that graphics are often represented much differently on the simulator than on a real device. You should try running your app on a device and see if the problem persists; I have had many 'problems' with custom buttons which turned out just to be improper rendering on the part of the simulator.
Since you are using the Interface builder, make sure that you are setting the button type to custom and that you have changed the behavior for all of the states. Under the dropdown menu of where you can set the type they also have StateConfig, where you can configure the look and text of your button for all of its different states: highlighted, default, disabled...Check that those settings are correct as well.
Hope this helps!
Tams
Your button frame size doesn't seem to match the size of your image. Your art should match the (button/view) frame size pixel for pixel, otherwise you may get blurry images and scaling representation artifacts.
Else, you can change the view content mode (UIViewContentMode) of the frame from UIViewContentModeScaleToFill to UIViewContentModeTopLeft

UIButton resizes when I change font?

I have several UIButtons, I'm trying to bulk change the font for all of them in InterfaceBuilder, but when I change the font, they auto-resize to the original image dimensions instead of what I had them set to, screwing up the layout. I would like to avoid having to resize and move everything around again any time I change the font. I could just set the font in a loop in code, but it seems redundant.
Is there a setting to stop this from happening?
This issue doesn't seem to occur in Xcode 4.0 or above.
Should anyone still be using a lesser version of Xcode I would suggest updating.

UIDatePicker graphical glitch

I'm experiencing a bad looking graphical glitch with UIDatePicker, and I'm wondering if anyone else has seen and/or resolved it. It is something non-deterministic, because every once in a while it goes away and looks normal.
Check out the highlight and shadow bars are shifted...
alt text http://img.skitch.com/20091218-x45e3i7bxw2ir4euymwxdrifhb.jpg
I have tried removing all other graphical elements. I have tried removing my slide-up animation so that it just appears in place (I thought there might be a break in animating the sub-views). At this point, I'm out of ideas for isolating this thing.
Thoughts? Thanks guys.
It looks like the picker view has been resized which they shouldn't be (as shown in IB by their frame properties being greyed out). I'd imagine this is the cause of the problems.
Wow, so yeah, big "f you" from Apple to all the devs who don't use their crap Interface Builder. Turns out Daniel was correct and there is indeed a resizing bug with UIDatePicker. No mention of this in the documentation.
I would have left this as a comment to his answer, but I wanted to elaborate on the solution.
You can set the frame origins to anything, but the size MUST be 320.0, 216.0 or else you will have non-deterministic graphical glitches.
I would also like to link to this spot-on blog post about some strange date issues with the UIDatePicker control. The NSDate class was basically a huge screw up from a localization standpoint, and they've attempted to deprecate the issues, creating an even worse disaster in the process.

UIWebView frame resize does not resize the inner content

if I change the frame of a UIWebView (scalesPageToFit property is YES), what do I have to do that the zooming level of a currently displayed webpage persists?
Let's say I have a UIWebView frame with a width of 200 pixels, and has zoomed into a website so that only one column is visible. After changing the width to 300, I still see the column with the same size, and additional space at the left and right. But what I would need is that I still only see this column, but bigger.
Any ideas what I have to do to achive this? I tried a lot of things, but nothing worked so far.
By the way, the iPhone built in Safari browser does exactly this thing (with the same website, so it's not content related) when rotating the iPhone... I see the same content, bug bigger, NOT more content as it happens with my current version of code.
Thanks for helping!
Markus
EDIT: Better answer:
mjdth is correct, you can use the contentMode property on the UIWebView. Very simple:
webView.contentMode = UIViewContentModeRedraw;
Old, crap answer:
This worked for me, but I was working with local pages and small amounts of content:
-(void)layoutSubviews
{
// Cause web view to reload content in order to display at new frame size
[webView reload];
}
I'd love to see a better solution that doesn't involve reloading the page though!
What do you have set for the webview's UIViewContentMode (can also be set in IB under the View section's "Mode")? Since you're resizing the view it may have something to do with this. Just a shot in the dark since I haven't tried it but hopefully this helps.
You may also want to try turning off scalesPageToFit before the transition and turning it back on after.