I have created a UIButton using CGRectMake, This button looks perfect for the portrait mode and remains fixed in the same place as I wanted. But, when I change the orientation to landscape button position changes. How can I fix this?
UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(216, 130, 64, 30)];
[button addTarget:self action:@selector(yourEditButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; button.tag = indexPath.row;
[button setImage:[UIImage imageNamed:@"btn-details.png"] forState:UIControlStateNormal];
[cell.contentView addSubview:button];
NSLog(@"sender.tag cell is%ld ",(long)button.tag);
Define macros like the following,
In your xib, drag button and put it inside the xib. Resize the screen width and height of xib and position your button for various of various screen width and height.Note down the width , height, x,y positions for various screen sizes and then use them in your following code