How to animate in a UICollectionViewCell? - ios

I'm trying to make a list like Pinterest using UICollectionView that has cell animation similar to Google Plus's list.
For UITableView, I can do cell animation in this call back
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{}
But UICollectionViewDelegate have no such the callback.
Any idea?

Nearly all of the animation you'll want to do should be handled by your UICollectionViewLayout subclass. UICollectionViews are pretty awesome, and can probably handle what you want to do very nicely.
Describe the animation you want to do, add an image, or show the code. I'm too lazy to go download apps to answer questions.

Related

Should I use a tableView for this

So I'm currently working on a project at work and wanted to get some feedback on how I would accomplish this. One of the mobile developers suggested I use a dynamic tableView, but it sounded kind of complicated for what I needed to accomplish. I just created UIButtons and UILabels, but felt that was rather cheesy. What do you all think? See image below
You can use UICollectionview or UITableview but
When using UICollectionview, you don't need to set buttons with tags or other things by getting selected items values. You can simply get -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath and in UITableViewDelegate:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
You get the selected row instead of the item, so for creating a grid or modified items, using UICollectionview is best. Here if you need rows only you can also use UITableview.

How do I impletment infinite scrolling for a blog app using RSS?

I was wondering if it is possible to implement infinite scrolling for a app that displays my blog's RSS feeds? Kind of like Instagram or Facebook when you scroll to the bottom it fetches more feeds. Can the same be done for an app using RSS feeds?
Implement this UITableView Delegate method:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
And do a check on your datasource array count with the indexPath of the row.
Then add more data to your array with a custom method
yes this will be possible - you will likely need to implement the logic for this yourself though. Check out this post:
http://michele.berto.li/infinite-scroll-on-ios-with-uitableview/
Look at this component : https://github.com/samvermette/SVPullToRefresh. There's a category which contains a method :
[tableView addInfiniteScrollingWithActionHandler:^{
// append data to data source, insert new cells at the end of table view
// call [tableView.infiniteScrollingView stopAnimating] when done
}];
You can look at the sample, it provides you a pretty way to implement that.

How to implement UITableViewCell without UITableView

I want to use the power of UITableViewCell like disclosure accessory, but I don't need the whole UITableView. Is this possible and appropriate to do so ? I don't see any delegate on UITableViewCell, so don't know where should I put code previously in - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath; any references or suggestions on this ?
Correct me if im wrong but .. Why would you use a cell like that ? If you dont want to use the power of the UITableView you can just add a view and do all the stuff you do in your cell. And that would keep the Apple Standard too.
You could just make a UITableView with one section and one row, and load that cell into it. This would be pretty easy to do and wouldn't run the risk of running afoul of the Apple review board.

UIButton grouped Buttons

I'm trying to create a button set up exactly like this:
How would I do this? Can someone show me the code? Is there a way to "Group" UIButtons like this?
You'll want to use a UITableViewController with the sections set to be UITableViewStyleGrouped.
Each of the groups is a section, so you'll want to return how many sections you have with - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView.
For every section, you want to specify how many rows there are with - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section.
You'll want to customize each cell with - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath (which, by the way, tells you which section's particular row you're modifying in the indexPath variable).
Finally, you'll want to handle the row click in - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath, using the pattern XCode provides for you:
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
Hope this helps!
That's a one-group UITableView with two rows (cells). The table style is UITableViewStyleGrouped. I'd recommend responding to selection of the cell using the delegate's –tableView:didSelectRowAtIndexPath: method as opposed to using UIButtons within the cell -- much nicer visual effect.
You can't group uibuttons like that. You can achieve this look-and-feel several ways, the most elegant is to use the grouped style uitableview.
However if you would want your buttons only to look like this, but not exactly like this, then you could also specify images for you buttons. Uglier way to do it, however much simpler ...

From UITableView to custom view

I have made a UITabelView that works nice, but when i now press a link I would like it to go to a new View, which should be different depending on the link choosen. How can i do that? If there is a nice tutorial it whould be nice.
Thanks for the help.
Implement UITableViewDelegate's method - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath and there display a picture.

Resources