Closed BrandonCopley closed 12 years ago
I added this method:
-(void)reloadData{ UIView *removeView;
while((removeView = [self.tableView viewWithTag:HEADER_VIEW_TAG]) != nil) {
[removeView removeFromSuperview];
}
[self.tableView reloadData];
}
and then:
(UIView )viewToHoldSectionView:(UIView )sectionView { // Enforce proper section header/footer view height abd origin. This is required because // of the way UITableView resizes section views on orientation changes. if (_orientation == EasyTableViewOrientationHorizontal) sectionView.frame = CGRectMake(0, 0, sectionView.frame.size.width, self.frame.size.height);
UIView *rotatedView = [[UIView alloc] initWithFrame:sectionView.frame]; rotatedView.tag = HEADER_VIEW_TAG; if (_orientation == EasyTableViewOrientationHorizontal) { rotatedView.transform = CGAffineTransformMakeRotation(M_PI/2); sectionView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin; } else { sectionView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; } [rotatedView addSubview:sectionView]; return rotatedView; }
I'd push, but I'm not 100% this fixes it...
I reviewed the EasyTableView source code and everything is fine. If you disable the -addSubview it won't work. Given that you said it works for you after you disable it, leads me to believe your delegate implementation may be doing something strange. The sample code works fine as is. Are you seeing something broken with the sample code?
I made a note as to how this gets fixed - it seems that for some reason the headerview hangs around if you rotate the device a few times.
brandon
On Mon, Jun 18, 2012 at 12:51 AM, Aleksey Novicov < reply@reply.github.com
wrote:
I reviewed the EasyTableView source code and everything is fine. If you disable the -addSubview it won't work. Given that you said it works for you after you disable it, leads me to believe your delegate implementation may be doing something strange. The sample code works fine as is. Are you seeing something broken with the sample code?
Reply to this email directly or view it on GitHub: https://github.com/alekseyn/EasyTableView/issues/21#issuecomment-6388379
Brandon Copley
PHONE::: 512.784.6060 EMAIL::: copley.brandon@gmail.com copley.brandon@gmail.com WEBSITE::: http://novationmobile.com/ http://www.novationmobile.com
The delegate simply returns a UIView - nothing fancy.
On Mon, Jun 18, 2012 at 1:14 AM, Brandon Copley copley.brandon@gmail.comwrote:
I made a note as to how this gets fixed - it seems that for some reason the headerview hangs around if you rotate the device a few times.
brandon
On Mon, Jun 18, 2012 at 12:51 AM, Aleksey Novicov < reply@reply.github.com
wrote:
I reviewed the EasyTableView source code and everything is fine. If you disable the -addSubview it won't work. Given that you said it works for you after you disable it, leads me to believe your delegate implementation may be doing something strange. The sample code works fine as is. Are you seeing something broken with the sample code?
Reply to this email directly or view it on GitHub: https://github.com/alekseyn/EasyTableView/issues/21#issuecomment-6388379
http://novationmobile.com/
Brandon Copley
CHIEF OPERATING OFFICER
PHONE::: 512.784.6060 EMAIL::: copley.brandon@gmail.com copley.brandon@gmail.com WEBSITE::: http://novationmobile.com/ http://www.novationmobile.com
Brandon Copley
PHONE::: 512.784.6060 EMAIL::: copley.brandon@gmail.com copley.brandon@gmail.com WEBSITE::: http://novationmobile.com/ http://www.novationmobile.com
Hmm, are you able to replicate the problem with the sample code?
Are you using ARC?
yes using ARC, have not tried with the sample code, I'll try that shortly. It should happen if I have an understanding of what's going on...but I'll try at some point tomorrow.
On Mon, Jun 18, 2012 at 1:23 AM, Aleksey Novicov < reply@reply.github.com
wrote:
Are you using ARC?
Reply to this email directly or view it on GitHub: https://github.com/alekseyn/EasyTableView/issues/21#issuecomment-6388699
Brandon Copley
PHONE::: 512.784.6060 EMAIL::: copley.brandon@gmail.com copley.brandon@gmail.com WEBSITE::: http://novationmobile.com/ http://www.novationmobile.com
It really seems like the issue is somewhere else. The code your reference above is somewhat meaningless because once the view is handed over to UITableView, it owns it.
It seems to me that the bug is how the uitableview headerview deals with subviews, still haven't looked at the sample to see if i can make it bug out - will do shortly.
On Mon, Jun 18, 2012 at 6:43 PM, Aleksey Novicov < reply@reply.github.com
wrote:
It really seems like the issue is somewhere else. The code your reference above is somewhat meaningless because once the view is handed over to UITableView, it owns it.
Reply to this email directly or view it on GitHub: https://github.com/alekseyn/EasyTableView/issues/21#issuecomment-6412456
Brandon Copley
PHONE::: 512.784.6060 EMAIL::: copley.brandon@gmail.com copley.brandon@gmail.com WEBSITE::: http://novationmobile.com/ http://www.novationmobile.com
Here is the code in my delegate:
(UIView)easyTableView:(EasyTableView)easyTableView viewForHeaderInSection:(NSInteger)section{
TableViewHeader_iPhone *headerView = [[TableViewHeader_iPhone alloc ] initWithFrame:CGRectMake(0, 0, easyTableView.frame.size.width, 21)];
return headerView;
}
and in headerView:
-(id)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
[[NSBundle mainBundle] loadNibNamed:
@"HomeComicTableViewHeader_iPhone" owner:self options:nil];
self.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight;
self.backgroundColor = [UIColor clearColor];
self.clipsToBounds = YES;
view.frame = self.bounds;
[self addSubview:view];
}
return self;
}
On Mon, Jun 18, 2012 at 6:45 PM, Brandon Copley copley.brandon@gmail.comwrote:
It seems to me that the bug is how the uitableview headerview deals with subviews, still haven't looked at the sample to see if i can make it bug out - will do shortly.
On Mon, Jun 18, 2012 at 6:43 PM, Aleksey Novicov < reply@reply.github.com
wrote:
It really seems like the issue is somewhere else. The code your reference above is somewhat meaningless because once the view is handed over to UITableView, it owns it.
Reply to this email directly or view it on GitHub: https://github.com/alekseyn/EasyTableView/issues/21#issuecomment-6412456
http://novationmobile.com/
Brandon Copley
CHIEF OPERATING OFFICER
PHONE::: 512.784.6060 EMAIL::: copley.brandon@gmail.com copley.brandon@gmail.com WEBSITE::: http://novationmobile.com/ http://www.novationmobile.com
Brandon Copley
PHONE::: 512.784.6060 EMAIL::: copley.brandon@gmail.com copley.brandon@gmail.com WEBSITE::: http://novationmobile.com/ http://www.novationmobile.com
You should be loading the nib file in the EasyTableView delegate method, and letting it do the initialization for you when it calls initWithCoder. You are going to get goofy results with the way you are doing it now. See http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html
Hm, I have not tried loading the nib in that fashion before, but you're right it may all come down to the nib loading wrong as I can't recreate - so proper is?
NSArray subviewArray = [[NSBundle mainBundle] loadNibNamed:@"nibName" owner:self options:nil]; UIView view = [subviewArray objectAtIndex:0];
I don't see why this would be any different, but perhaps that is the issue:
I think the problem with the way you are doing it is that you end up with two instances of TableViewHeader_iPhone. Apple recommends using UINib for these purposes:
UINib *nib = [UINib nibWithNibName:@"TableViewHeader_iPhone" bundle:nil];
[nib instantiateWithOwner:self options:nil];
This link might be useful for you:
http://useyourloaf.com/blog/2011/02/28/speeding-up-table-view-cell-loading-with-uinib.html
Section header views seem to get "stuck" on rotation -
I think it has something to do with this method and the addSubview method...If I disable the "addSubview" method they don't get stuck, perhaps we need an image tag? I don't quite know yet.