this might look simple but i am not able to Find the solution for this…when i use this below code the text get placed at right postion as mentioned in the CGRect frame.
[self.view addSubview:[self createLabel:CGRectMake(50,480,50,20):@”Status:”]];
-(UILabel*)createLabel:(CGRect)frame :(NSString*)labelTitle
{
UILabel *myLabel = [[UILabel alloc] initWithFrame:frame];
[UIFont fontWithName:@"Arial" size:13];
myLabel.textAlignment = UITextAlignmentLeft;
}
But when i use this below Code the text is getting placed at rightmost corner of the frame…its not getting placed at right position as mentioned in the CGRect frame..can anyone tell whats the problem happening with this..
[self.view addSubview:[self createLabel:CGRectMake(50,340,150,20):aRequests.request_details]];
NOTE:aRequests.request_details is coming from webservices..
Your method doesn’t return any object. Try to add
return myLabel;at the end of it.And you are not setting new title:
myLabel.text = labelTitle;