Rounded labels in Interface Builder...? [duplicate] - objective-c

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I create a round cornered UILabel on the iPhone?
how to use rounded corner label in iphone,UILabel Round Corners
Still pretty much getting started with Xcode and Interface Builder. I made a UI screen with several 'label' fields to display random data. But when I change the label color from the screen background color, it looks awful because they're perfect squares. Is there a way to round the corners for labels?
Thanks!

Quoting from another SO answer:
iPhone OS 3.0 and later supports the cornerRadius property on the CALayer class. Every view has a CALayer instance that you can manipulate. This means you can get rounded corners in one line now:
That post has a pretty detailed description of how to implement this behavior.

Related

TVCardView rounded corners strange behaviour

I'm setting up a new tvOS app with a UISplitViewController and a UICollectionView as a detail view. To achieve some nice out-of-the-box focus behaviour, I'm trying to use TVCardView inside the UICollectionViewCell and adding an image view and a label to the card views content view (in interface builder). That works, but the problem is that the card views always applies rounded corners to the content once they have been selected. Initially all views have sharp corners, but as soon as a cell has been selected, it switches to rounded corners.
First of all, I don't even want rounded corners and in Apples examples, I never see those rounded corners anyway: https://developer.apple.com/documentation/tvuikit/tvcardview
But even then, it's kind of useless to have rounded corners only partially after selection.
Has anyone experience with TVCardView and knows about this strange behaviour? I cannot find any example code or more detailed documentation. I also tried to use TVLockupView instead, but that doesn't seem to be supported by interface builder.
This was an SDK bug and is fixed in newer versions of Xcode/tvOS - just verified in Xcode 13.2.1 Simulator.
For older versions you have to work around it (I mentioned one here in the comment - TVCardView rounded corners strange behaviour)
Be aware of the issue that:
typically you have a UIImageView inside of the card view.
Confusingly, you have to TURN OFF
adjust on ancestor focus
user interaction enabled
on the UIImageView.
If you don't, the image view will "doubly" expand, when the card view expands!
This can be incredibly confusing, as it may/may not round corners when "not doubly expanded" and often there are weird margin issues, parts of the image never visible and so on.

Objective-C continuous horizontal scrolling text [duplicate]

This question already has an answer here:
How to make marquee UILabel / UITextField / NSTextField
(1 answer)
Closed 8 years ago.
is it possible to create continuous horizontal scrolling for UILabel in Objective-C.
The code in HTML would look like this, so you can get a better idea what I'm talking about.
<marquee behavior="scroll" direction="left">Scrolling text goes here</marquee>
Thanks!
There's no built in control that provides this functionality. You may want to take a look at the open source project MarqueeLabel, which is a subclass of UILabel that adds support for this effect.

IB Elements Jump Back To Original Position [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
UIView Animation Inconsistent Result
I have an iPhone app where I've set a lot of the UI elements of one of the view controllers up in Interface Builder so that when the view loads, those elements animate out to to where I want them. However, on one of the buttons, I have a tap gesture which dims the screens by bringing a black UIView to the front with its alpha property set to .5.
Whenever the background dimmer comes to the front, all the UI Elements that I've animated to different places jump back to where they originally were placed.
I wish I could post code but I can't since it's a business venture.
Anyone think they have an idea?
Edit: An obvious fix is once I bring up the background dimmer, just reanimate everything else back to where it should be. But that's a messy solution and I would rather just have them stay where they were animated to.
Also, I animated them by setting the frame using CGRectMake and such if that helps.
EDIT 2:
The jump is being caused by calling:
[self.view bringSubviewToFront:view];
I don't know how to stop that from happening though.
Have to give credit to #rob mayoff. It has to do with using autolayouts in storyboards as talked about in this question: Autolayouts

iOS - Enlarge view (Screenshot provided) [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
UIImageView Transform Scale
I am trying to achieve something similar to the screenshot down below.
I have tried to do this by simply changing the view's frame property and increasing its width and height but it
1) does not really enlarge the view and its subviews it just increases the size
2) It only increases its size from the left so it does not look even
Also is there a way I can have this animated? I could just place it in UIView's animateWithDuration: block right?
There are 2 approaches you can take -
If you are using standard UITableView then simply use Managing the Reordering of Rows
If you are not using UITableView and are doing something more custom with UIViews then
what you need is a property called scale. Scaling a view is done using Core Graphics Affine transforms when you're looking to affect the UIView (as opposed to the layer which use Core Animation transforms).
To scale a view use - this scales the view to 2x.
// 2x
[yourView setTransform:CGAffineTransformMakeScale(2.0, 2.0)];
To translate, use
// Move origin by 100 on both axis
[yourView setTransform:CGAffineTransformMakeTranslation(100.0, 100.0)];
You can also play around with alpha to set it to say 0.5 to give it that extra cool look you have put in the screenshot.
To animate these, wrap them in an animation block. If you want to transform the view with both of these, then you need to concatenate them.
apply a transformation to the view's layer :)
that can be also be animated :) in fact, it implicitly is!
self.view.transform = CGAffineTransformScale(self.view.transform, 2,2);

What are the drawbacks to using a rounded background image as opposed border-radius?

Unfortunately, I have to use IE 8 & 9 for our application.
My people want a rounded corner box.
OPTION 1 : Use border-radius and 'edge'. We will get rounded for people with 9 but not 8....
OPTION 2 : Just go with a rounded image like we have for years, this will look the same in both browsers...
Here's my question - are there any drawbacks to using OPTION 2 BESIDES the loading time for the image?
If one zooms into the page, the rounded image will look pixelated. If you want to, you can use CSS3Pie for rounded borders in IE8, however html5please recommends against.