lakshmen
lakshmen

Reputation: 29094

Alignment of text of the label in Xcode

I would like to shift the text in the label slightly. I have already placed the text on the right by aligning in the attributes inspector. But I would like to move it slightly to the left. Not sure what button to press. I have looked through all the features in attributes inspector, but still not able to find it.

Here is how it looks like now: enter image description here

Like to move the zero slightly to the left somemore. How do i do it?

Upvotes: 1

Views: 1056

Answers (1)

rdelmar
rdelmar

Reputation: 104092

If you want to move the text within the label, you will have to subclass UILabel and override drawTextInRect: like this:

@implementation RDLabel

- (void)drawTextInRect:(CGRect)rect {
    CGRect newRect = CGRectMake(0, 0, rect.size.width - 10, rect.size.height);
    [super drawTextInRect:newRect];
}
@end

This will move the text 10 points to the left if you have the text right justified.

Upvotes: 1

Related Questions