To answer the second question first, you might look at CGRectOffset(CGRect rect, x, y)
where rect
is the original rectangle and x and y are the values by which the new rectangle is offset from the original rectangle. You can use this statement to define the value of imageView.frame
.
For the first question, add the imageView as a subView of the mainView: [mainView addSubview:imageView]
.