Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-18-2011, 07:42 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 3
Ranadhir is on a distinguished road
Default iPhone hide portion of image in UIScrollView

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?
Ranadhir is offline   Reply With Quote
Old 09-18-2011, 10:57 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2009
Location: Benicia, CA
Age: 50
Posts: 152
That Don Guy is on a distinguished road
Default

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.
That Don Guy is offline   Reply With Quote
Old 09-18-2011, 12:58 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 3
Ranadhir is on a distinguished road
Default

Quote:
Originally Posted by That Don Guy View Post
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.
Ranadhir is offline   Reply With Quote
Old 09-29-2011, 03:58 AM   #4 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 3
Ranadhir is on a distinguished road
Default

Quote:
Originally Posted by That Don Guy View Post
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.
Ranadhir is offline   Reply With Quote
Reply

Bookmarks

Tags
for view, uiimage, uiimageview, uiscrollview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 400
16 members and 384 guests
7twenty7, Eclectic, eski, EvilElf, fiftysixty, HemiMG, iOS.Lover, JackReidy, jarv, pbart, Pudding, sacha1996, teebee74, UMAD, VinceYuan, yuncarl28
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,121
Posts: 402,905
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:11 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0