UIScrollview header - iphone

i am creating a book store Application,so i am showing books in a scroll view with background image(shelf image),i have added bouncing functionality to scroll view,i am adding buttons with book images to scroll view like grid in 4x3 thumbnails
when i scrolled to top the background image is repeating with those shelfs,its ok for me
but when i dragging(bouncing) Scroll view to down its repeating same shelf on the top
so how can i add any header to Uiscrollview to show like Apple ibooks
Can any one help me ..thx in Advance...

If you want to add a header, designate a table view delegate (can be the same as your data source) and give it the methods tableView:viewForHeaderInSection: and tableView:heightForHeaderInSection:. From the first one you return the view you want as the header. The second one is obvious.
I'm not sure if that will solve your problem, because I'm not sure I understand your problem or how you propose to solve it.

Related

how to create a sectioned TableView for profile in iPhone

I saw this picture on Internet:
the section with the add Photo Frame and two rows (First, Last)...
How do you achieve a design like that!!!
I only know how to make rows (static and dynamic) in xCode using the full width of the screen but not in a single section but not making such a división and adding a frame out of the other two rows
my designs are like this
Any help I'll appreciate
thanks in advance
It's not really clear that the example you've given is actually embedding the first, last part into a table view. It could just as easily be a single cell that has embedded views with borders to look like rows. Here are a few ways I see to accomplish the view you've given.
Have them be actual rows - but use a custom cell layout that offsets the 'First' and 'Last' labels to be further to the right. Then create a UIImageView for the profile that sits on top of the UITableView cells, but inside of it. Basically insert it as the first subview of the UITableView. It should cover the top left of those top two cells. You can do this since those cells have a static known hight and you've set the left offset. Another option would be just inserting it into your top cell, but having it overflow the bounds and setting clipsToBounds = NO.
Make the entire top view a custom UIView that uses CALayers or CoreGraphics to manually draw the lines and layout such that it looks like part of the table view. Set that as the TableView header, or the first section Header.
There are a lot more things you can do like changing frame layout as well.
you can achieve this with the use of xib read carefully and if you don't understand anything you can ask me again it's bit tricky
in you xib create a UIView and design for your photo and firstname, lastname cells with the use of textfields image views and all and then take a UITableView.
now drag your UIView and drop it on your UITableView so that it will be considered as your table header and your first section now will be as you designed like photo with firstname and lastname fields.
i've done this in manier projects of mine so hope this way you can also do this thing and ask me if you need any help.

How to lay out scrollable iPhone view

I need advice on the most pragmatic way to layout the following view. As you can see from the image attached, I have a static logo and text that appears at the top of the view, followed by a variable number of items.
Initially, I was going to use a TableView for the variable number of items, that way I would be able to load any given number of cells at runtime.
My problem is that if I drop a tableView onto this view below my static logo and text, when the user scrolls, the static logo and text will remain fixed. I need both the static logo/text AND the tableView to scroll up.
My next inclination is to use a scrollView, inside which I would place my tableView and static logo.
Is this the most pragmatic way to approach the problem? If so, will there be usability issues when scrolling the scrollView vs scrolling the tableView? In my mind this could get messy.
Any advice on the best way to approach this is greatly appreciated.
Using a table view inside of a scroll view is a bad idea and warned against by Apple in their docs. Basically the internal gesture recognizers can conflict and create a clunky user experience. The best path forward would be to go with the tableview (which is a subclass of scroll view) and have two different kinds of cells– one for the logo and one for the repeating contents at the bottom. Make the first cell the logo and adjust the table view's settings to format it to your heart's content.

Auto position sibling UIViews

I have 4 UIViews stacked in a UIScrollView.
When any one of the UIViews are tapped, I want that particular view to expand and show some more content and this would mean the sibling views below the selected view has to push themselves down.
I could have used UITableView but there are all kinds of weird stuff happening when you change the row heights dynamically which is why I chose this fallback.
Can I use autoresizingmask to do this ?
Cheers
Your question Answer is not so simple,you Need to use Different Logic Means You know how Much Width and Hight your Each view have after Clicking on it and then you can pass the reference of View to setContentSize of Scrollview.here is some tutorial which solved my problem when i was putting some run time data in Scrollview.
link
link
Hope it will be helpfull for you.

UIScrollView always bounce upwards and does not show scroll bar in iphone

This is probably simple but I do not seem to get it to work. I have a view and inside it I have a scroll view and inside it I have a view with some labels and a button. the height of the text inside the labels changes according to some condition so I need to scroll down to see it. But whenever I try to scroll down it bounce back up without giving me a chance to view the rest of the view.
Basically, I want when I scroll down, the view to remain down as it normally should. Besides I do not see the scroll bar at all when I'm scrolling.
I know I probably do not understand how scroll views work, so I'd appreciate any help to explain to me the behavior of scroll views.
P.S. I built my whole view in a nib file and this specific setup That I mentioned at the beginning is based on a suggestion from one question I read here.
Thanks, Mohsen
you need to set content size of your scroll view
[scrollView setContentSize:CGSizeMake(360,1000)];
you can make the content size dynamic as per your calculation.

iPhone: How to Place a Scrollview Inside of Tableview Cell

I want to put a scroll view inside of the table view cell. I have a number of buttons in one cell of table view and I need to scroll that cell to show the appropriate button.
If you want to use a vertical scroll view then I wouldn't suggest you doing it because, as TechZen wrote, there will be a mess in this case.
If you want the inner scroll view to scroll horizontally then it might be achieved by 2 ways:
Implement a custom table view cell that will include a scroll view inside it.
Add a scroll view as a sub-view to your cell that you will return from tableView:cellForRowAtIndexPath: method.
I suggest you to use the second approach.
There are plenty of examples online. Usually the sub-views are labels or image views, but it is not complicated at all to add a scroll view instead...
I don't think you can do this. It would require nesting of scrollviews which isn't really supported.
Even if it was, it would be very difficult for a user to know which scrollview they were hitting with their pudgy finger. Remember, you don't have the one pixel precision of a mouse on the iPhone. You have an area of at least 15x15 pixels. You don't have a scroll bar but instead just drags anywhere on the screen.
Instead, you should use a master-detail pattern. Selecting the cell in the tableview pushes a detail view which has the scroll view with all the buttons.
Why do you want to do it like this?
I think the best idea is to draw your table view manually above your uiscrollview. I did it, and it works. It just takes more effort and drawing accuracy. But that takes a lot of time. :)