alekseyn / EasyTableView

Horizontal and vertical scrolling table views for iOS
BSD 3-Clause "New" or "Revised" License
584 stars 157 forks source link

Sections #12

Closed BrandonCopley closed 12 years ago

BrandonCopley commented 12 years ago

Alright why couldn't we implement headers and footers? I believe I have added headers and footers and done a great implementation.

Can I share this code?

-(UIView)tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section{ if ([delegate respondsToSelector:@selector(easyTableView:viewForHeaderInSection:)]) { return [delegate easyTableView:self viewForHeaderInSection:section]; } return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; }

-(UIView)tableView:(UITableView )tableView viewForFooterInSection:(NSInteger)section{

if ([delegate respondsToSelector:@selector(easyTableView:viewForFooterInSection:)]) {
    return [delegate easyTableView:self viewForFooterInSection:section];
}
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];

}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

if ([delegate respondsToSelector:@selector(numberOfSectionsInEasyTableView::)]) {
    return [delegate numberOfSectionsInEasyTableView:self];
}

return 1;

}

in the .h

This seems to work swimmingly.

alekseyn commented 12 years ago

That looks great. I never tested it before, assuming it was going to be problematic. But it's nice to know it just works. Feel free to issue a Pull Request, or I can just merge your code from the blog post. Thanks!

alekseyn commented 12 years ago

I've merged your changes, but in the process made numerous other changes to support multiple sections. Most of my changes were stylistic, though some were functional changes too. I decided to break the existing interface just to keep it simpler for newer users. Existing users shouldn't have much difficulty in fixes required to use the new method calls. I've documented mostly everything in the README. Do you mind pulling my latest changes just to make sure everything still works for you? You might see a bug or two where you need to replace "index" with "indexPath". Thanks.

Your app Comic Turtle looks great! Well done. And thanks for letting me know that EasyTableView has been used successfully in a production app! I've used EasyTableView with a number of clients, but their apps have yet to be released, and I have not used it in any of my own Yodel Code branded apps. Thanks again for helping with the extensions for multiple sections and section headers and footers.

BrandonCopley commented 12 years ago

Great,

I will yes soon - I'm working on now allowing rotated headers an footers, they work but everything shows up rotated :P.

Brandon

On Mar 1, 2012, at 5:56 PM, Aleksey Novicov reply@reply.github.com wrote:

I've merged your changes, but in the process made numerous other changes to support multiple sections. Most of my changes were stylistic, though some were functional changes too. I decided to break the existing interface just to keep it simpler for newer users. Existing users shouldn't have much difficulty in fixes required to use the new method calls. I've documented mostly everything in the README. Do you mind pulling my latest changes just to make sure everything still works for you? You might see a bug or two where you need to replace "index" with "indexPath". Thanks.

Your app Comic Turtle looks great! Well done. And thanks for letting me know that EasyTableView has been used successfully in a production app! I've used EasyTableView with a number of clients, but their apps have yet to be released, and I have not used it in any of my own Yodel Code branded apps. Thanks again for helping with the extensions for multiple sections and section headers and footers.


Reply to this email directly or view it on GitHub: https://github.com/alekseyn/EasyTableView/issues/12#issuecomment-4274130

alekseyn commented 12 years ago

I'll carry on this thread under Issue #14.