iOS collapse header section in UITableView? - iphone

I have a UITableView that has a header view that I want to use to display content. When no content exists, I want to hide the header view (which is a UIView class) and have the TableView Cells slide to the top of the view.
It's like
____________
| ---------- |
| | | |
| | header | |
| | | |
| ---------- |
| ---------- |
| | cell | |
| ---------- |
| |
When I call
[theHeaderView setHidden:YES]
The content in the header view disappears but the cells of my TableView remain halfway down the screen to where the header had pushed them. so i wind up with:
____________
| |
| EMPTY |
| SPACE |
| |
| |
| ---------- |
| | cell | |
| ---------- |
| |
What is the proper way to hide the header view and have the table view cells move to the top of the screen?
and then i want to reopen my header later on with new content and push the cells down again.
thanks!

You need to change the tableView:heightForHeaderInSection: rather than just making the header view hidden. I don't recall if this will animate when you reload the table (reloadSections:withRowAnimation:).

Related

When I export markdown in org mode, tables are exported in HTML format

I have tried ox-pandoc, but it didn't work well。I get the error
ox-pandoc fails with `error in process sentinel: Symbol's function definition is void: run
hmm, and the issue is open for some time.
Now I want to transform this:
| Header | Header | Right |
|--------+--------+-------|
| Cell | Cell | $10 |
| Cell | Cell | $20 |
The result should be
| Header | Header | Right |
|--------|--------|-------|
| Cell | Cell | $10 |
| Cell | Cell | $20 |
Is there a way to transform the markdown file which includes HTML table content to a markdown-only file?

Scrollview Scrolling with dynamic images on them and vertical/horizontal scrolling but one at a time

I am able to achieve horizontal scrolling with dynamic addition of images on them, with infinite scrolling and lazy loading of images as well.
Actually, I am kind of stuck, about how to proceed with vertical scrolling of image in regards to horizontal image being displayed.
For Eg: I pull down some images from server, those are random pics, and those pics are associated to some albums of a user on my server.
So, when user scrolls left to right (horizontal) then scrollview should display all the downloaded bunch of images, but when user scroll up/down then scrollview should display other images associated to album of current image (from horizontal mode). Say I downloaded image 1,2,3 and 4. and When I scroll up/down then say for index 2, it should display 2.1, 2.2 etc which is nothing but linked to the album.
I have the json with me for both vertical and horizontal screens. however, I am not sure how to modify my current flow (infinite scrolling+lazy load) with albums kinda view.
Thanks for the help.
Create vertical ScrollViews inside your horizontal ScrollView. Each vertical ScrollView represents an album. Fill all images in that album to this vertical ScrollView. Set direction lock to yes for all ScrollViews. The whole structure should like below.
------------- -------------
| | | |
| ------- | | ------- | > Vertical ScrollViews
| | | | | | | | with images inside
| | | | | | | |
| | | | | | | |
| | | | | | | |
| ------- | | ------- |
| | | |
-------------------------------------------------------------------------------
| | | | | |
| | ------- | | ------- | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | Horizontal ScrollView |
| | | | | | | | | with vertical Scrolls |
| | ------- | | ------- | |
| | | | | |
| ------------- ------------- |
-------------------------------------------------------------------------------
For solve this issue you have to create touch method for horizontal scroll and according to touch update the vertical scroll Scrollview data.If you need then I also post some tips of code.
if(CGRectContainsPoint([imgView frame], [touch locationInView:scrollView]))
{
[self ShowDetailView:imgView];
break;
}
}
}
-(void)ShowDetailView:(UIImageView *)imgView
{
selectOther_ImageView.image = imgView.image;
}

What is the best way to "paginate" a loooong SVG file on iOS?

I am facing an interesting problem with SVG and iOS.
I need to render very long SVG files (up to about 5mb large), which hasn't been a problem using UIWebView. I also haven't had a problem scrolling them smoothly with JS, but since I'm waiting on my developer program application to be approved I haven't tested the performance on an actual device.
I'm now trying to achieve a page-turning effect like how the iBooks app flips pages. It doesn't have to be as elaborate and intricate, the gist of the idea is that the next section of the svg will "wipe over" the last.
Reason being, I need both "pages" of content to remain static to ease the reading of the content during the "flipping" process. Scrolling very quickly makes the contents of the SVG difficult to read.
Here is a graphic representation of what I would like to achieve:
---------------------------
| |
| |
| |
| 1 |
| |
| |
| |
| |
---------------------------
---------------------------
| | |
| | |
| | |
| 2 | 1 |
| |-> |
| | |
| / |
| / |
---------------------------
---------------------------
| | |
| | |
| | |
| 2 | 1 |
| |-> |
| | |
| / |
| / |
---------------------------
---------------------------
| |
| |
| |
| 2 |
| |
| |
| |
| |
---------------------------
Looking forward to some interesting ideas from you veterans!
I haven't rut to such needs, but from what I know, it could be made by two UIViews (or any of their subclasses). All you have to do is a custom animation on flip(a simple one if you interested in flip only, a harder one if you need the animation actually to go one with the finger). And of course you'll need to put corresponding part of your file to those views. Actually I would suggest using 3 views, so you'll be able to put content of the next "page" while it still offscreen. That will make your animation smoother.

How to get the area surrounding the visible rect of the mapview?

I can get the visible rect of a mapView with self.mapView.visibleMapRect, but how would I get a rect of the area which is slightly outside this rect?
---------------------
| |
| |
| ---------- | * the map shown on the screen
| | | |
| | * | |
| | | |
| ---------- |
| |
| | <- the rect that I want
---------------------
It depends what you mean by 'the rect that I want'. Are you talking about the parent view (or window)? If it's a parent view and you're accessing it from the view controller, you can use self.view.frame. You'd need to clarify what area it is that you're after.

Detail view to show only in table area of screen?

I'd like to be able to show the detail view of a table, but not push a new screen, but only show the detail view where the table is.
What's the best way of setting this up.. if it is actually possible?
------------------------------------
| |
| nav bar or tool bar |
------------------------------------
| |
| this area stays static |
| |
------------------------------------ ---------------------------------
| | | |
| | | |
| | | |
| table… | | new uitableview pushed. |
| | cell clicked-> | only the table area changes |
| | | |
| | | |
| | | |
------------------------------------ ---------------------------------
| | | | | |
| | | | | | < tab bar
| | | | | |
------------------------------------
If you want an effect similar to pushing a UIViewController I guess you could animate the tableview out and animate the new view into position at the same time. I don't think there's a way to do it using the actual UINavigationController mechanism, as it replaces the current view on the UINavigationController's stack with the new viewcontroller's view.
I would suggest two methods:
Insert the uitableView into a UIView, this way you will always have reference to a container which holds the uitable view. Also you need to just manage the frame sizes of the child subviews of this table view. In your case it would be the first uitableview and on button click the next subview can be added using the reference of the parent container.
Alternatively you can have a macro which has the positions of the uitableview's frame with respect to the parent UIView. On inserting another subview you can set the frame therby giving an impression of overlaying above the base uitableview.
Just have another view on top of the table view and make it hidden. Set the contents and unhide it when needed.
The best way, in my opinion of resolving this is to use a UINavigationController that doesn't have its nav bar showing and doesnt fill the screen. So, your static areas are just plain UIViews, but your table view is actually inside a UINavigationController, but seems like it is a normal table - as the navigation bar is hidden.
This means you would push the "dynamic" content to the UINavigationController and that would animate that section of the screen, but the rest of the screen would remain static.