I am brand new to iPhone app development. I am trying to create an image reader using UIScrollView. I have a single image which has several portions. I need to focus one of the portions of the image and hide the rest. Till now I am only able to focus the required part of an image but have no clue how to hide the rest. I had a suggestion that, I need to add four views at top, bottom, left and right. I need to hide those as per requirement. But, I was able to go no where with the suggestion. Can you please tell me how can I implement the functionality?
The "four subviews on top of your image" method is probably the best one.
Let Xi and Yi be the width and height of your image, and (Xa, Ya) and (Xb, Yb) be the upper-left and lower-right corners of the part of the image you want. You need to have four subviews located as follows:
"Top": from (0, 0) to (Xi, Ya)
"Left": from (0, Ya) to (Xa, Yb)
"Right": from (Xb, Ya) to (Xi, Yb)
"Bottom": from (0, Yb) to (Xi, Yi)
In other words, you create views that are the width of the image that are above and below the area you wand to show, and then, within that "strip" between the two views, you create views to the left and right of the area you want to show.
The "four subviews on top of your image" method is probably the best one.
Let Xi and Yi be the width and height of your image, and (Xa, Ya) and (Xb, Yb) be the upper-left and lower-right corners of the part of the image you want. You need to have four subviews located as follows:
"Top": from (0, 0) to (Xi, Ya)
"Left": from (0, Ya) to (Xa, Yb)
"Right": from (Xb, Ya) to (Xi, Yb)
"Bottom": from (0, Yb) to (Xi, Yi)
In other words, you create views that are the width of the image that are above and below the area you wand to show, and then, within that "strip" between the two views, you create views to the left and right of the area you want to show.
Thanks for your reply. From last weeks I am working on iPhone. I don't have much idea about the language till now. What I didn't understand is where should I add the subviews? I guess it should be to the UIImageView. If I add the subviews after I add the Image will these subviews hide the image also while I hide them? I might be asking very annoying questions. As I am very much new to this platform and told to finish it very urgently, I am quite messed up. If possible please help me with some code.
The "four subviews on top of your image" method is probably the best one.
Let Xi and Yi be the width and height of your image, and (Xa, Ya) and (Xb, Yb) be the upper-left and lower-right corners of the part of the image you want. You need to have four subviews located as follows:
"Top": from (0, 0) to (Xi, Ya)
"Left": from (0, Ya) to (Xa, Yb)
"Right": from (Xb, Ya) to (Xi, Yb)
"Bottom": from (0, Yb) to (Xi, Yi)
In other words, you create views that are the width of the image that are above and below the area you wand to show, and then, within that "strip" between the two views, you create views to the left and right of the area you want to show.
Thanks mate. I was able to implement what you have suggested. Thanks a ton.