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.
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.
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.
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.