小胖说事37-----iOS基础知识之UIScrollview的代理和Build Active Architecture Only属性

总述:今天对UIScrollview的代理记忆有点模糊,所以查了一下文档,并记录下来;还有就是对于Xcode编译打包时候的Build Active Architecture Only属性的理解也记录下来,毕竟,好记性不如烂笔头,O(∩_∩)O哈哈哈~

1.scrollview的代理:

//只要滚动了就会触发
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;   
{
//    NSLog(@" scrollViewDidScroll");
    NSLog(@"ContentOffset  x is  %f,yis %f",scrollView.contentOffset.x,scrollView.contentOffset.y);
}
//开始拖拽视图
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;   
{
   NSLog(@"scrollViewWillBeginDragging");
}
//完成拖拽
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; 
{
   NSLog(@"scrollViewDidEndDragging");
}
//将开始降速时
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;   
{
   NSLog(@"scrollViewWillBeginDecelerating");
}

//减速停止了时执行,手触摸时执行执行
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;   
{
   NSLog(@"scrollViewDidEndDecelerating");
}
//滚动动画停止时执行,代码改变时出发,也就是setContentOffset改变时
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;
{
   NSLog(@"scrollViewDidEndScrollingAnimation");
}
//设置放大缩小的视图,要是uiscrollview的subview
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;   
{
   NSLog(@"viewForZoomingInScrollView");
    return viewA;
}
//完成放大缩小时调用
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale; 
{
    viewA.frame=CGRectMake(50,0, 100, 400);
   NSLog(@"scale between minimum and maximum. called after any 'bounce' animations");
}// scale between minimum and maximum. called after any 'bounce' animations

//如果你不是完全滚动到滚轴视图的顶部,你可以轻点状态栏,那个可视的滚轴视图会一直滚动到顶部,那是默认行为,你可以通过该方法返回NO来关闭它
- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView;   
{
    NSLog(@"scrollViewShouldScrollToTop");
   return YES;
}

- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView;     
{
    NSLog(@"scrollViewDidScrollToTop");
}

2.对Build Active Architecture Only属性的理解

这个属性设置为yes,是为了debug的时候编译速度更快,它只编译当前的architecture版本。

而设置为no时,会编译所有的版本。

这个是设备对应的architecture:

armv6:iPhone 2G/3G,iPod 1G/2G

armv7:iPhone 3GS/4/4s,iPod 3G/4G,iPad 1G/2G/3G

armv7s:iPhone5, iPod5

编译出的版本是向下兼容的,比如你设置此值为yes,用iphone4编译出来的是armv7版本的,iphone5也可以运行,但是armv6的设备就不能运行。

所以,一般debug的时候可以选择设置为yes,release的时候要改为no,以适应不同设备。

大家可以加头部的QQ群一起交流学习~

你可能感兴趣的:(小胖说事37-----iOS基础知识之UIScrollview的代理和Build Active Architecture Only属性)