iOS左是master,右边是detail
2016-01-18 10:32
344 查看
点击左边的菜单(按钮),右边显示详情
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
if (scrowFangXiang)
{
[selfchangeCaiPinLeiTitle:section];
}
}
- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view
forSection:(NSInteger)section
{
if (!scrowFangXiang)
{
[selfchangeCaiPinLeiTitle:section+1];
}
}
-(void)scrollViewWillBeginDragging:(UIScrollView*)scrollView
{
isScrollSetSelect =YES ;
lastContentOffset =self.categoryTableView.contentOffset.y;
}
-( void )scrollViewDidScroll:(UIScrollView *)scrollView
{
if (lastContentOffset <self.categoryTableView.contentOffset.y
)
{
//向上
scrowFangXiang =NO;
lastContentOffset =self.categoryTableView.contentOffset.y;
}
elseif (self.categoryTableView.contentOffset.y
<lastContentOffset )
{
//向下
scrowFangXiang =YES;
lastContentOffset =self.categoryTableView.contentOffset.y;
}
}
-(void)clickLeftSelectButton:(UIButton *)button
{
[self.selectBtnsetSelected:NO];
[self.selectBtnsetBackgroundColor:chenjie];
[button setBackgroundColor:[UIColorwhiteColor]];
[button setSelected:YES];
self.selectBtn = button;
isScrollSetSelect =NO;
[self.categoryTableViewscrollToRowAtIndexPath:[NSIndexPathindexPathForRow:0inSection:button.tag
-110] atScrollPosition:UITableViewScrollPositionTopanimated:YES];
}
-(void)changeCaiPinLeiTitle:(NSInteger)caipinTag
{
if (isScrollSetSelect ==YES)
{
[self.selectBtnsetSelected:NO];
self.selectBtn.backgroundColor =chenjie;
UIButton *btn = (UIButton*)[self.viewviewWithTag:caipinTag+110];
[btn setSelected:YES];
btn.backgroundColor = [UIColorwhiteColor];
self.selectBtn = btn;
}
}
需要注意在getter方法里切勿使用self.shopData,因为self.shopData会调用getter方法,造成死循环
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
if (scrowFangXiang)
{
[selfchangeCaiPinLeiTitle:section];
}
}
- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view
forSection:(NSInteger)section
{
if (!scrowFangXiang)
{
[selfchangeCaiPinLeiTitle:section+1];
}
}
-(void)scrollViewWillBeginDragging:(UIScrollView*)scrollView
{
isScrollSetSelect =YES ;
lastContentOffset =self.categoryTableView.contentOffset.y;
}
-( void )scrollViewDidScroll:(UIScrollView *)scrollView
{
if (lastContentOffset <self.categoryTableView.contentOffset.y
)
{
//向上
scrowFangXiang =NO;
lastContentOffset =self.categoryTableView.contentOffset.y;
}
elseif (self.categoryTableView.contentOffset.y
<lastContentOffset )
{
//向下
scrowFangXiang =YES;
lastContentOffset =self.categoryTableView.contentOffset.y;
}
}
-(void)clickLeftSelectButton:(UIButton *)button
{
[self.selectBtnsetSelected:NO];
[self.selectBtnsetBackgroundColor:chenjie];
[button setBackgroundColor:[UIColorwhiteColor]];
[button setSelected:YES];
self.selectBtn = button;
isScrollSetSelect =NO;
[self.categoryTableViewscrollToRowAtIndexPath:[NSIndexPathindexPathForRow:0inSection:button.tag
-110] atScrollPosition:UITableViewScrollPositionTopanimated:YES];
}
-(void)changeCaiPinLeiTitle:(NSInteger)caipinTag
{
if (isScrollSetSelect ==YES)
{
[self.selectBtnsetSelected:NO];
self.selectBtn.backgroundColor =chenjie;
UIButton *btn = (UIButton*)[self.viewviewWithTag:caipinTag+110];
[btn setSelected:YES];
btn.backgroundColor = [UIColorwhiteColor];
self.selectBtn = btn;
}
}
需要注意在getter方法里切勿使用self.shopData,因为self.shopData会调用getter方法,造成死循环
相关文章推荐
- 不让苹果开发者账号折磨我
- iOS 遍历字符串得到每一个字
- iOS runtime 消息分发过程
- 'libxml/tree.h' file not found
- iOS技术开发之路
- 关于iOS百度地图的基本使用
- iOS上传图片到服务器
- iOS上传语音到服务器
- iOS上传视频到服务器
- iphone屏幕参数iphone3GS~Iphone6 plus
- iOS_正则表达式判断手机型号、邮箱、手机号、身份证、昵称、密码等
- iOS中左右滑动切换,滑动标签页导航的设计思路
- 一般IOS项目中的滑动标签栏的实现
- [ios仿系列]仿支付宝手势解码
- iOS 过期提醒
- IOS关于图片上传
- iOS 原生二维码扫描
- iOS开发中使用FMDB解决数据存储问题---(写的比较详细,仔细看,有很大的参考价值)
- iOS 9键盘类型合集
- IOS硬件解码VTDecompressionSession失效