吃货876APP参考文档

来源:互联网 发布:淘宝在哪看自己的标签 编辑:程序博客网 时间:2024/06/02 17:16
1. 这个是滑动时实现全屏显示的方法,但后来弃用了,因为我不知道怎么哪个地方有问题,实现效果一直不理想

http://code4app.com/ios/Full-Screen-Scroll-TableView/4fd55c446803fa584f000000


2.上拉刷新目前用到的开源:

http://code4app.com/ios/SVPullToRefresh/4fa8dc1506f6e78c70000000  (这个好像确实是多拉动几次的话就崩溃了)

这个下拉刷新的实现更加好看,内容也更多,有空的话可以研究下加这个:

http://code4app.com/ios/Pull-To-Refresh-TableView/4f681c096803fa2c63000004


把其他几个也罗列出来吧:

1.http://code4app.com/ios/Pull-Up-To-Refresh/512c31e36803fa5576000000

2.水滴实现效果:

   http://code4app.com/ios/Slime-Refresh/4ff55e116803fa223d000000


3.列表刷新+JSON+HTTP:

http://code4app.com/ios/%E5%88%97%E8%A1%A8%E5%88%B7%E6%96%B0-SBJSON-HTTP/4fc88ad06803fa5072000000

4.http://code4app.com/ios/SVPullToRefresh/4fa8dc1506f6e78c70000000

5.http://code4app.com/ios/Refresh-and-load-more-Table/4f9555bb06f6e7ac71000000


3.二级页面类似于 “在路上”那种点击后跳到相应section:

http://code4app.com/ios/PopoverView/50612fe56803fae712000000

不过这个地方需要注意的是,程序中都是单击就会响应事件,所以到时候就算咱们加进去tableview它也好响应单击tableview的事件,我采取的方法是将那个项目中的两个手势事件改成双指单击,这样的话当加进去tableview的时候就可以响应tableview的单击事件了:

a.

UITapGestureRecognizer *tap = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(tapped:)];

    

    //chenyy 下边两行

    tap.numberOfTouchesRequired =2;

    tap.numberOfTapsRequired =1;

    [selfaddGestureRecognizer:tap];

    [tap release];


b.

UITapGestureRecognizer *tap = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(tapped:)];

    tap.numberOfTouchesRequired =2;

    tap.numberOfTapsRequired =1;

    [self.viewaddGestureRecognizer:[tapautorelease]];


*************************************************************

3.上边的那个还是不理想,因为如果都得是两指单击的话在取消视图时也得是两指,现在又想出个好方法,暂时证明是成功的:

即在定义代码的两个手势时,都加上 (参考资料是:http://blog.csdn.net/bihailantian1988/article/details/8167395)

tap.cancelsTouchesInView=NO;  这句话,双指识别的那个就不要了:

a.

UITapGestureRecognizer *tap = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(tapped:)];

//    tap.numberOfTouchesRequired = 2;

//    tap.numberOfTapsRequired = 1;

    tap.cancelsTouchesInView=NO;//chenyy test

    [self.viewaddGestureRecognizer:[tapautorelease]];


b.

UITapGestureRecognizer *tap = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(tapped:)];

    

    //chenyy 下边两行

//    tap.numberOfTouchesRequired = 2;

//    tap.numberOfTapsRequired = 1;

    tap.cancelsTouchesInView=NO;//chenyy test

    [selfaddGestureRecognizer:tap];

    [tap release];


追回说明:若按原来的默认调用方法 

[PopoverViewshowPopoverAtPoint:CGPointMake(275,400+1)inView:self.viewwithContentView:[daysViewautorelease] delegate:self];   那么小tableview弹出后左右两边的空隙较大,现在为了改变此种情况:

只需要在此方法:

- (void)showAtPoint:(CGPoint)point inView:(UIView *)view withContentView:(UIView *)cView   中将

注释的那句改为下边未注释的即可:

//    CGRect contentFrame = CGRectMake(boxFrame.origin.x + padding, boxFrame.origin.y + padding, contentWidth, contentHeight);

    CGRect contentFrame = CGRectMake(boxFrame.origin.x +5 , boxFrame.origin.y + padding -10, contentWidth+2 *padding - 10, contentHeight + padding +10); //cyy




4.优惠券二级页面异步加载图片参考的是:(注:此处我是让服务端把图片的宽和高返回给我了,我自己倒也可以得到,但那样的话无法实现异步了好像,因为无法确定frame)http://code4app.com/ios/%E5%9B%BE%E7%89%87%E4%B8%8B%E8%BD%BD%E5%92%8C%E4%BF%9D%E5%AD%98/508bacee6803fa9b09000000

其中主要代码如下:

#pragma mark - 方法二  

void UIImageFromURL( NSURL * URL,void (^imageBlock)(UIImage * image),void (^errorBlock)(void) )

{

    dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT,0 ), ^(void)

                   {

                       NSData * data = [[[NSDataalloc]initWithContentsOfURL:URL]autorelease];

                       UIImage * image = [[[UIImagealloc]initWithData:data]autorelease];

                       dispatch_async( dispatch_get_main_queue(), ^(void){

                           if( image != nil )

                           {

                               imageBlock( image );

                           } else {

                               errorBlock();

                           }

                       });

                   });

}




使用的话:

NSString *url = pDetail.chProimg;

        UIImageFromURL( [NSURLURLWithString:url], ^(UIImage * image )

                       {

                           cell.cusDetailImagView.image=image;

                       }, ^(void){

                           NSLog(@"error!");

                       });



4.优惠券一级页面当点击主持人头像时的弹框用的是(KGModal)

http://code4app.com/ios/KGModal/507d72886803faa46a000000

这个用法很简单的,直接把

[[KGModalsharedInstance]showWithContentView:contentViewandAnimated:YES];

这句话加上就行

注意:弄了一下午加上午了,不知道怎么回事,我把加上去后可以实现弹出,但点击关闭后整个屏幕完全不响应了,后来群里兄弟提醒它的留言部分有句话:

“@燕吻泪: @燕吻泪: 这个是arc得,你需要将alloc的对象release掉就行了。”   然后我就照着他说的把alloc的对象release了,但还是不行,头疼,再看才发现这个代码明明是arc的,但外包在给我们做的时候并没有在工程的 Build Phases这个地方注明kGmodal是arc(即并没有注明 -fobjc-arc 这句话),现在我在 Build Phases 这个地方在 KGModal.m文件后加上 -fobjc-arc后  问题解决!!!

原创粉丝点击