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 08-29-2011, 08:48 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 2
Lucas is on a distinguished road
Default Need a Button on Image View on a Scroll view

Hi there,

I am very new to iOS dev. It almost seems as if I have no business developing but I am trying really hard to learn.

My boss has asked me to develop a little app for an idea he has, which I can't believe I actually did (for the most part). I am done with everything else except one part.

Here is how I need it to work: I have a long.png that would need the ability to scroll. At the very bottom of the .png, there is a button that would take you back to the main page.

Currently, In my .xib file I do have the view scroller and the image view on top of it but I am unable to put the button at the bottom of the image view. it just wants to go on the scroll view.

I was researching this and it looks as if this has to be done programmatically, which I do not know how to do that.

What I am asking is for someone to literally walk me through this. I would be heavily indebted to you if you could write out the commands on the h. & .m files for me. If there is way to post an Xcode project, that would be perfect.

I really don't have a wonderful grasp of the terminology. Although, I AM trying to learn this stuff, Not all of the dots are connecting for me just yet.

Screwing this up won't get me fired but it will probably make my boss second guess his judgement of me. By the way, I did not volunteer for it, he requested that i do this so i am under pressure to complete this as soon as possible.

Any help would be appreciated.

Thank you in advance,

Lucas
Lucas is offline   Reply With Quote
Old 08-29-2011, 11:21 AM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Lucas View Post
Hi there,

I am very new to iOS dev. It almost seems as if I have no business developing but I am trying really hard to learn.

My boss has asked me to develop a little app for an idea he has, which I can't believe I actually did (for the most part). I am done with everything else except one part.

Here is how I need it to work: I have a long.png that would need the ability to scroll. At the very bottom of the .png, there is a button that would take you back to the main page.

Currently, In my .xib file I do have the view scroller and the image view on top of it but I am unable to put the button at the bottom of the image view. it just wants to go on the scroll view.

I was researching this and it looks as if this has to be done programmatically, which I do not know how to do that.

What I am asking is for someone to literally walk me through this. I would be heavily indebted to you if you could write out the commands on the h. & .m files for me. If there is way to post an Xcode project, that would be perfect.

I really don't have a wonderful grasp of the terminology. Although, I AM trying to learn this stuff, Not all of the dots are connecting for me just yet.

Screwing this up won't get me fired but it will probably make my boss second guess his judgement of me. By the way, I did not volunteer for it, he requested that i do this so i am under pressure to complete this as soon as possible.

Any help would be appreciated.

Thank you in advance,

Lucas

Lucas,

I don't have time to hand-hold you through every step in doing this I'm afraid.

You should be able to do this quite easily in Interface Builder.

You should have a view controller that has a root view. (When you select the nib (.xib) file for the view controller, it's "file's owner" will show as a view controller, and the view outlet of "file's owner" should be linked to the top-level view in the nib).

Inside that root view, you will have a scroll view. The scroll view will contain a view that it uses to manage it's content. inside that scroll view will be your image.

If you put the button inside the scroll view, then when the user scrolls around, the button will move too. Is that what you want?

If it is, then just select a button object from the object library in the utilities area and drag it into the scroll view's main view. You want it inside the scroll view's main view, not inside the image view. You can then hook up an action to the button.

The views are listed inside a parent view with the bottom-most view listed first. The item drawn on top of all the others will be at the bottom of the list. (Exactly opposite of what you might expect.)


If you don't want the button to scroll around, then you should put it inside the view controller's main view, not inside the scroll view.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 08-29-2011, 12:20 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 2
Lucas is on a distinguished road
Default Thanks for repsonding Duncan

Quote:
Originally Posted by Duncan C View Post
Lucas,

I don't have time to hand-hold you through every step in doing this I'm afraid.

You should be able to do this quite easily in Interface Builder.

You should have a view controller that has a root view. (When you select the nib (.xib) file for the view controller, it's "file's owner" will show as a view controller, and the view outlet of "file's owner" should be linked to the top-level view in the nib).

Inside that root view, you will have a scroll view. The scroll view will contain a view that it uses to manage it's content. inside that scroll view will be your image.

If you put the button inside the scroll view, then when the user scrolls around, the button will move too. Is that what you want?

If it is, then just select a button object from the object library in the utilities area and drag it into the scroll view's main view. You want it inside the scroll view's main view, not inside the image view. You can then hook up an action to the button.

The views are listed inside a parent view with the bottom-most view listed first. The item drawn on top of all the others will be at the bottom of the list. (Exactly opposite of what you might expect.)


If you don't want the button to scroll around, then you should put it inside the view controller's main view, not inside the scroll view.
Hi Duncan,

I have seen the root view controller before but it relates to my Main page if I am correct. For my app, I added new subclass views. I don't see a root view controller for this new page you mention but let me see if I can explain what I want a little better so that we are both on the same page.

In this nib file (thanks for that lingo correction), I have a view, I add a scroll view on top of it, Adjust it to the height that I need and then I add the image view on top of it. So far so good. in the simulator, I can move my beautiful pic up and down.

Since this is a subview of the main view, at the bottom of the image view, I want to add in a "back" button which will take me back to the main page. When I add the button, it adds it in the scroll view and not the image view. What ends up happening is that the button is stuck behind the image view and I can't access it. I can only put the back button at the top of the scroll view and that is not functionality I want.

Is there a way to put an image inside the scroll view rather then an image view?

I appreciate your advice and thank you for helping me out.

Lucas
Lucas is offline   Reply With Quote
Reply

Bookmarks

Tags
image view, problem, scroll view

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: 389
6 members and 383 guests
JackReidy, jeroenkeij, Sami Gh, yomo710, Yosh_K
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,671
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JackReidy
Powered by vBadvanced CMPS v3.1.0

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