Uba Duba
Uba Duba

Reputation: 241

Adding Labels to scrollviews (the left edge is getting cut off) in IOS

I'm having trouble with adding a label to a scroll view, I am trying to start the label a little in from the edge of the scroll view frame, but without adding any horizontal scrolling (the label width is well below the scroll view width, it's the height of the label that goes beyond the scroll frame height)

including a screenshot (green is the scrollview frame, red is the label frame)

enter image description here

Upvotes: 0

Views: 248

Answers (2)

Jack Freeman
Jack Freeman

Reputation: 1414

Some code would help. But basically you need to set the x origin to a few pixels.

//Inset the x origin by 10 pixels
UILabel *someLabel = [[UILabel alloc] initWithFrame:CGRectMake(10,0,50,50)]; 

Upvotes: 1

Obj-Swift
Obj-Swift

Reputation: 2942

I am not sure if i understood it right but Just add a blank space before your textLabel string. something like

[NSString stringWithFormat:@"  Dummy Data...", myLabel];

Upvotes: 0

Related Questions