




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
PAGEI摘要隨著人們生活節(jié)奏的加快,一部分未婚人士沒(méi)有足夠的時(shí)間去專(zhuān)門(mén)為自己的婚禮做準(zhǔn)備,<<秀婚禮>>這個(gè)APP能讓這部分人方便地準(zhǔn)備婚禮,市場(chǎng)需求廣闊。秀婚禮共有5大模塊:1.購(gòu)物2.搶拍3.戲婚禮4.故事5.我給用戶(hù)提供全面的婚禮信息,讓用戶(hù)方便完美地”結(jié)婚”.關(guān)鍵詞:婚禮;購(gòu)物目錄摘要 II第1章項(xiàng)目分析 11.1項(xiàng)目背景 11.2工程進(jìn)度計(jì)劃 11.3運(yùn)行環(huán)境 1第2章結(jié)構(gòu)設(shè)計(jì) 2第3章實(shí)現(xiàn) 33.1購(gòu)物 33.1.1商品 33.1.2排序 63.1.3分類(lèi) 73.1.4寶貝詳情 83.1.5分享 93.1.6購(gòu)買(mǎi)商品 103.2搶拍 113.2.1搶拍列表 113.2.2搶拍詳情 143.3戲婚禮 193.4故事 223.4.1精彩故事 223.4.2故事詳情 313.4.3夢(mèng)工廠 333.4.4商家 373.4.5地圖 383.5我的 393.5.1登錄 393.5.2個(gè)人信息 403.5.3收藏 41第4章結(jié)束語(yǔ) 42附錄:主要源程序 43姓名:常小賓論文題目:秀婚禮PAGE1第1章項(xiàng)目分析1.1項(xiàng)目背景隨著科技的發(fā)展和社會(huì)的進(jìn)步,互聯(lián)網(wǎng)已成為人們密不可分的一部分,網(wǎng)上購(gòu)物成為潮流,手機(jī)的信息推廣逐步加大,出于方便人們和推廣的目的,我們團(tuán)隊(duì)開(kāi)發(fā)出這款秀婚禮.讓即將結(jié)婚的人能隨時(shí)隨地的為自己的婚禮做準(zhǔn)備,設(shè)計(jì)一個(gè)完美的婚禮.1.2工程進(jìn)度計(jì)劃開(kāi)始前兩天設(shè)計(jì)界面架構(gòu),接下來(lái)一周半實(shí)現(xiàn)分工后的各自界面,再花一周的時(shí)間進(jìn)行整合上項(xiàng)。1.3運(yùn)行環(huán)境可用操作系統(tǒng):Mac操作系統(tǒng)iphone移動(dòng)設(shè)備
第2章結(jié)構(gòu)設(shè)計(jì)本著簡(jiǎn)單美觀的理念,項(xiàng)目采用了UITablebarController(多視圖控制器)來(lái)布局,UITablebarController管理著5個(gè)UIViewcontroller(視圖控制器),每個(gè)UIViewcontroller完成一個(gè)模塊.第3章實(shí)現(xiàn)上面已經(jīng)把我們的設(shè)計(jì)理念和所用技術(shù),下面我介紹下各個(gè)模塊的作用以及功能的實(shí)現(xiàn)(只介紹負(fù)責(zé)部分).3.1購(gòu)物3.1.1商品圖3.1.1購(gòu)物頁(yè)面主要用到的UI控件UINavigationController,UITabBarController來(lái)控制,整個(gè)的頁(yè)面的效果采用UICollectionView控件做出來(lái)的,根據(jù)圖片寬高返回來(lái)的數(shù)據(jù)自適應(yīng)大小的瀑布流效果每個(gè)圖片右下方的位置都有一個(gè)UIButton,用戶(hù)在瀏覽商品的同時(shí),可以根據(jù)自己的喜好對(duì)自己喜歡的商品進(jìn)行收藏,在后邊我的收藏里可以查看自己收藏的商品圖片-(void)loadDataByPageNumber:(NSInteger)aPageNumbersortNum:(NSInteger)aSortNumcategory:(NSInteger)aCategory{AFHTTPRequestOperationManager*manager=[[AFHTTPRequestOperationManageralloc]initWithBaseURL:[NSURLURLWithString:BASE_URL]];[manager.responseSerializersetAcceptableContentTypes:[NSSetsetWithObjects:@"application/json",@"text/josn",@"text/javascript",@"text/html",@"text/plain",nil]];NSDictionary*dic=@{@"page":[NSNumbernumberWithInteger:aPageNumber],@"sort":[NSNumbernumberWithInteger:aSortNum],@"category":[NSNumbernumberWithInteger:aCategory]};[managerGET:@""parameters:dicsuccess:^(AFHTTPRequestOperation*operation,idresponseObject){[selfdataReceiveSuccessful:responseObject];}failure:^(AFHTTPRequestOperation*operation,NSError*error){NSLog(@"%@",error);}];}#pragmamark-UITableView-(CGFloat)collectionView:(UICollectionView*)collectionViewlayout:(UICollectionViewWaterfallLayout*)collectionViewLayoutheightForItemAtIndexPath:(NSIndexPath*)indexPath{Shop*shop=[self.dataArrayobjectAtIndex:indexPath.row];return150*([shop.heigthfloatValue]/[shop.widthfloatValue]);}-(NSInteger)collectionView:(UICollectionView*)collectionViewnumberOfItemsInSection:(NSInteger)section{return_dataArray.count;}-(UICollectionViewCell*)collectionView:(UICollectionView*)collectionViewcellForItemAtIndexPath:(NSIndexPath*)indexPath{Shopcells*cell=[collectionViewdequeueReusableCellWithReuseIdentifier:@"cell"forIndexPath:indexPath];Shop*shop=[self.dataArrayobjectAtIndex:indexPath.row];cell.shop=shop;returncell;}-(void)collectionView:(UICollectionView*)collectionViewdidSelectItemAtIndexPath:(NSIndexPath*)indexPath{Shop*shop=[self.dataArrayobjectAtIndex:indexPath.row];GoodsDetailViewController*goodsVC=[[GoodsDetailViewControlleralloc]init];goodsVC.hidesBottomBarWhenPushed=YES;goodsVC.shop=shop;[collectionViewdeselectItemAtIndexPath:indexPathanimated:YES];[self.navigationControllerpushViewController:goodsVCanimated:YES];[goodsVCrelease];}-(void)dealloc{self.classifyView=nil;self.collectionView=nil;self.sortView=nil;[superdealloc];}3.1.2排序圖3.1.2設(shè)計(jì)之初,為了用戶(hù)在瀏覽商品的同時(shí),可以根據(jù)商品的受追捧度來(lái)區(qū)分商品,我們做出來(lái)根據(jù)”熱度”這一條件對(duì)商品進(jìn)行了區(qū)分排序效果圖整體上是一個(gè)UIView,上邊一個(gè)裁剪好的image添加在UIImageView上,在添加一個(gè)UILable控件,在整體的UIImageView上,最后關(guān)聯(lián)手勢(shì)方法,排序分為所有商品默認(rèn)排序和按收藏?zé)岫冗M(jìn)行排序3.1.3分類(lèi)圖3.1.3用戶(hù)在瀏覽商品的同時(shí)也可以對(duì)商品進(jìn)行分類(lèi)商品分類(lèi)實(shí)現(xiàn)了按婚紗,禮服,婚鞋,配飾,首飾,婚慶用品,家居禮品,和全部商品的八個(gè)分類(lèi)3.1.4寶貝詳情圖3.1.41.點(diǎn)擊購(gòu)物頁(yè)面圖片推送到寶貝詳情頁(yè)面2.商品的詳細(xì)介紹,商品簡(jiǎn)介,商品價(jià)格,并且在此頁(yè)面能夠收藏商品和分享商品,點(diǎn)擊去購(gòu)買(mǎi),能夠推送到第三方鏈接的淘寶購(gòu)物頁(yè)面3.1.5分享圖3.1.5分享頁(yè)面的實(shí)現(xiàn)利用了第三方shareSDK,能夠提供很多的分享平臺(tái),我們只實(shí)現(xiàn)了新浪微博,騰訊微博,網(wǎng)易微博,搜狐微博,人人網(wǎng)的對(duì)該商品的分享功能!3.1.6購(gòu)買(mǎi)商品圖3.1.6用戶(hù)點(diǎn)擊購(gòu)買(mǎi)商品,能夠自動(dòng)跳轉(zhuǎn)到鏈接淘寶界面的第三方的webView頁(yè)面,用戶(hù)可以自行選擇購(gòu)買(mǎi)商品和瀏覽同類(lèi)的其它商品3.2搶拍3.2.1搶拍列表圖3.2.1搶拍模塊主界面提供了了搶拍商品列表,本身是一個(gè)tableView,tableView用自定義cellCommodityTableViewCell數(shù)據(jù)用Commodity封裝,代碼如下:-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{Commodity*commodity=[self.dataArrayobjectAtIndex:indexPath.row];staticNSString*cellName=@"huazai";CommodityTableViewCell*cell=[tableViewdequeueReusableCellWithIdentifier:cellName];if(!cell){cell=[[[CommodityTableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:cellName]autorelease];}modity=commodity;returncell;}cell用set方法傳值,根據(jù)接口提供的數(shù)據(jù)(兩個(gè)日期)來(lái)確定搶拍商品的狀態(tài),即將開(kāi)始,搶拍中,結(jié)束(由于后臺(tái)原因部分狀態(tài)未顯示):-(void)setCommodity:(Commodity*)commodity{if(_commodity!=commodity){[_commodityrelease];_commodity=[commodityretain];}_titleLable.text=_commodity.title;[_brand_logodonwLoadImage:_commodity.brand_logo];[_bigImagedonwLoadImage:_commodity.photograph_path];_discount_priceLable.frame=CGRectMake(10,0,([_commodity.discount_pricelength]+2)*10,30);_original_priceLable.frame=CGRectMake(10+_discount_priceLable.frame.size.width,0,[_commodity.original_pricelength]*10,30);_discount_priceLable.text=[NSStringstringWithFormat:@"¥%@",_commodity.discount_price];_original_priceLable.text=_commodity.original_price;((UIView*)[selfviewWithTag:200]).frame=CGRectMake(0,14.5,_original_priceLable.frame.size.width,1);NSDateFormatter*datef=[[NSDateFormatteralloc]init];[datefsetDateFormat:@"yyyy-MM-ddHH:mm:ss"];NSDate*date=[NSDatedateWithTimeIntervalSinceNow:0];//NSLog(@"%@",date);NSDate*date2=[datefdateFromString:[[_commodity.preferential_end_timestringByReplacingOccurrencesOfString:@"T"withString:@""]stringByReplacingOccurrencesOfString:@"Z"withString:@""]];NSDate*date1=[datefdateFromString:[[_commodity.preferential_start_timestringByReplacingOccurrencesOfString:@"T"withString:@""]stringByReplacingOccurrencesOfString:@"Z"withString:@""]];NSTimeIntervalendSinceNowTime=[date2timeIntervalSinceDate:date];NSTimeIntervalnowSinceBeginTime=[datetimeIntervalSinceDate:date1];[datefrelease];if(endSinceNowTime>0&&nowSinceBeginTime>0){_smallView.image=[UIImageimageNamed:@"discountMarkWill.png"];//拍賣(mài)中if(self.beginButton){[_beginButtonremoveFromSuperview];}self.beginButton=[[UIButtonalloc]initWithFrame:CGRectMake(200,0,70,30)];_beginButton.userInteractionEnabled=NO;_beginButton.layer.cornerRadius=5;[_beginButtonsetTitle:@"搶拍中"forState:UIControlStateNormal];_beginButton.backgroundColor=[UIColorcyanColor];[_lastViewaddSubview:_beginButton];[_beginButtonrelease];}elseif(nowSinceBeginTime<0){_smallView.image=[UIImageimageNamed:@"discountMarkIng.png"];//即將開(kāi)始if(self.beginButton){[_beginButtonremoveFromSuperview];}self.beginButton=[[UIButtonalloc]initWithFrame:CGRectMake(200,0,90,30)];_beginButton.userInteractionEnabled=NO;_beginButton.layer.cornerRadius=5;[_beginButtonsetTitle:@"即將開(kāi)始"forState:UIControlStateNormal];_beginButton.backgroundColor=[UIColorcyanColor];[_lastViewaddSubview:_beginButton];[_beginButtonrelease];}else{_smallView.image=[UIImageimageNamed:@"discountMarkFinish.png"];//結(jié)束if(self.endButton){[_endButtonremoveFromSuperview];}self.endButton=[[UIButtonalloc]initWithFrame:CGRectMake(210,0,50,30)];//_endButton.userInteractionEnabled=YES;_endButton.layer.cornerRadius=5;[_endButtonsetTitle:@"結(jié)束"forState:UIControlStateNormal];_endButton.backgroundColor=[UIColorgrayColor];[_lastViewaddSubview:_endButton];[_endButtonrelease];}}3.2.2搶拍詳情圖搶拍詳情界面提供了具體某個(gè)商品的當(dāng)前狀態(tài),圖片介紹,原價(jià)現(xiàn)價(jià),品牌,以及更多地詳細(xì)信息.下邊有搶拍按鈕,狀態(tài)允許點(diǎn)擊進(jìn)入寶貝搶拍界面.搶拍詳情界面本身是在UIViewcontroller上面添加了一個(gè)scrollView和一個(gè)view,view上面有兩個(gè)button,scrollView上面按照接口數(shù)據(jù)布局最后是一個(gè)UIViewcontroller,UIViewcontroller完成剩下數(shù)據(jù)的布局部分代碼://得到數(shù)據(jù)NSDictionary*dic=[[NSJSONSerializationJSONObjectWithData:_dataoptions:0error:nil]objectForKey:@"discount_commodity"];self.shopsArray=[NSMutableArrayarrayWithCapacity:1];for(inti=0;i<6;i++){Shop*shop=[[Shopalloc]init];shop.picUrl=[[dicobjectForKey:[NSStringstringWithFormat:@"recommend_commodity%d",i+1]]objectForKey:@"photo_path"];shop.width=[[dicobjectForKey:[NSStringstringWithFormat:@"recommend_commodity%d",i+1]]objectForKey:@"width"];shop.heigth=[[dicobjectForKey:[NSStringstringWithFormat:@"recommend_commodity%d",i+1]]objectForKey:@"height"];shop.shopID=[[dicobjectForKey:[NSStringstringWithFormat:@"recommend_commodity%d",i+1]]objectForKey:@"id"];[_shopsArrayaddObject:shop];}self.array=[NSMutableArrayarrayWithCapacity:1];for(NSDictionary*smallDicin[dicobjectForKey:@"discount_commodity_particulars"]){CellModel*cellmodel=[[CellModelalloc]init];cellmodel.photo_path=[smallDicobjectForKey:@"photo_path"];cellmodel.width=[smallDicobjectForKey:@"width"];cellmodel.height=[smallDicobjectForKey:@"height"];[_arrayaddObject:cellmodel];}NSMutableArray*smallArray=[NSMutableArrayarrayWithCapacity:1];for(inti=0;i<6;i++){CellModel*cellmodel=[[CellModelalloc]init];cellmodel.photo_path=[[dicobjectForKey:[NSStringstringWithFormat:@"recommend_commodity%d",i+1]]objectForKey:@"photo_path"];cellmodel.width=[[dicobjectForKey:[NSStringstringWithFormat:@"recommend_commodity%d",i+1]]objectForKey:@"width"];cellmodel.height=[[dicobjectForKey:[NSStringstringWithFormat:@"recommend_commodity%d",i+1]]objectForKey:@"height"];cellmodel.idString=[[dicobjectForKey:[NSStringstringWithFormat:@"recommend_commodity%d",i+1]]objectForKey:@"id"];[smallArrayaddObject:cellmodel];}[_arrayaddObject:smallArray];self.buy_url=[dicobjectForKey:@"buy_url"];NSString*brand_logo=[dicobjectForKey:@"brand_logo"];self.brand_info=[dicobjectForKey:@"brand_info"];self.brand_name=[dicobjectForKey:@"brand_name"];//數(shù)據(jù)賦值_descriptionLable.frame=CGRectMake(0,230,self.view.bounds.size.width,rect.height);_descriptionLable.font=[UIFontsystemFontOfSize:15];[self.imageViewdonwLoadImage:photograph_path];_descriptionLable.text=_brand_info;_discount_priceLable.frame=CGRectMake(10,0,([discount_pricelength]+2)*10,30);_original_priceLable.frame=CGRectMake(10+_discount_priceLable.frame.size.width,0,[original_pricelength]*10,30);_discount_priceLable.text=[NSStringstringWithFormat:@"¥%@",discount_price];_original_priceLable.text=original_price;((UIView*)[self.viewviewWithTag:200]).frame=CGRectMake(0,14.5,_original_priceLable.frame.size.width,1);_brandView.frame=CGRectMake(0,230+_descriptionLable.frame.size.height+10,320,30);_brand_logo.frame=CGRectMake(80,0,80,30);[_brand_logodonwLoadImage:brand_logo];_brand_nameLable.frame=CGRectMake(160,0,130,30);_brand_nameLable.text=_brand_name;((UIScrollView*)[self.viewviewWithTag:120]).contentSize=CGSizeMake(self.view.bounds.size.width,280+_descriptionLable.frame.size.height+self.view.bounds.size.height-30);//搶拍狀態(tài)時(shí)間控制-(void)changeTime{//NSLog(@"################");_endSinceNowTime=_endSinceNowTime-1;inttime3=_endSinceNowTime/1;((UILabel*)[self.viewviewWithTag:300]).font=[UIFontsystemFontOfSize:12];((UILabel*)[self.viewviewWithTag:300]).text=[NSStringstringWithFormat:@"距結(jié)束時(shí)間:%d時(shí)%d分%d秒",time3/3600,time3%3600/60,time3%3600%60];_nowSinceBeginTime=_nowSinceBeginTime-1;inttime4=_nowSinceBeginTime/1;((UILabel*)[self.viewviewWithTag:301]).font=[UIFontsystemFontOfSize:12];((UILabel*)[self.viewviewWithTag:301]).text=[NSStringstringWithFormat:@"距開(kāi)始時(shí)間:%d時(shí)%d分%d秒",time4/3600,time4%3600/60,time4%3600%60];}//點(diǎn)擊立即搶拍進(jìn)入下一個(gè)界面-(void)comToBuy_url//搶購(gòu){GoodsPictureViewController*buy_urlVC=[[GoodsPictureViewControlleralloc]init];buy_urlVC.picUrl=self.buy_url;[self.navigationControllerpushViewController:buy_urlVCanimated:YES];[buy_urlVCrelease];}圖點(diǎn)擊合作品牌view彈出品牌簡(jiǎn)介視圖,(多的不做介紹)點(diǎn)擊淘寶圖片進(jìn)入下一個(gè)界面-(void)comtoTaobao{//NSLog(@"@@@@@@@@@@@@@@@");GoodsPictureViewController*buy_taoBao=[[GoodsPictureViewControlleralloc]init];buy_taoBao.picUrl=self.buy_url;[self.navigationControllerpushViewController:buy_taoBaoanimated:YES];}圖scrollView上添加的viewcontroller有兩種自定義cell,一種cell加載一張圖片,另一種上除了布局外還在6個(gè)imageview上添加了輕拍手勢(shì),點(diǎn)擊進(jìn)入寶貝界面://手勢(shì)-(void)turnNext1:(UITapGestureRecognizer*)sender{Shop*shop=[self.shopsArrayobjectAtIndex:0];GoodsDetailViewController*goodsVC=[[GoodsDetailViewControlleralloc]init];goodsVC.hidesBottomBarWhenPushed=YES;goodsVC.shop=shop;[self.navigationControllerpushViewController:goodsVCanimated:YES];[goodsVCrelease];}3.3戲婚禮圖3.3戲婚禮就是一個(gè)segmentcontrol控制3個(gè)tableView,tableView上顯示相關(guān)文檔相關(guān)代碼:[superviewDidLoad];self.title=@"戲婚禮";self.navigationController.navigationBar.translucent=NO;//**********************配置當(dāng)前導(dǎo)航欄的按鈕self.navigationItem.rightBarButtonItem=[[[UIBarButtonItemalloc]initWithTitle:@"隨機(jī)"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(doRightItem)]autorelease];//**************sementControl************NSArray*title=@[@"整人攻略",@"擋門(mén)攻略",@"誠(chéng)意考驗(yàn)"];self.segmentControl=[[UISegmentedControlalloc]initWithItems:title];_segmentControl.tintColor=[UIColorcolorWithRed:150/255.0green:220/255.0blue:250/255.0alpha:1.0];_segmentControl.frame=CGRectMake(0,0,320,40);_segmentControl.selectedSegmentIndex=0;[_segmentControladdTarget:selfaction:@selector(segmentSelected:)forControlEvents:UIControlEventValueChanged];[self.viewaddSubview:_segmentControl];[_segmentControlrelease];self.bigScrollView=[[UIScrollViewalloc]initWithFrame:CGRectMake(0,K_BIGTOP_MAGIN,320,self.view.bounds.size.height-64)];_bigScrollView.contentSize=CGSizeMake(320*3,300);_bigScrollView.backgroundColor=[UIColorblueColor];_bigScrollView.delegate=self;_bigScrollView.bounces=NO;_bigScrollView.pagingEnabled=YES;_bigScrollView.directionalLockEnabled=YES;[self.viewaddSubview:_bigScrollView];[_bigScrollViewrelease];self.scrollView1=[[UIScrollViewalloc]initWithFrame:CGRectMake(0,0,320,_bigScrollView.frame.size.height)];_scrollView1.delegate=self;_scrollView1.backgroundColor=[UIColorredColor];_scrollView1.tag=300;[_bigScrollViewaddSubview:_scrollView1];[_scrollView1release];self.scrollView2=[[UIScrollViewalloc]initWithFrame:CGRectMake(320,0,320,_bigScrollView.frame.size.height)];_scrollView2.delegate=self;_scrollView2.backgroundColor=[UIColoryellowColor];[_bigScrollViewaddSubview:_scrollView2];[_scrollView2release];self.scrollView3=[[UIScrollViewalloc]initWithFrame:CGRectMake(640,0,320,_bigScrollView.frame.size.height)];_scrollView3.delegate=self;_scrollView3.backgroundColor=[UIColorgreenColor];_scrollView3.tag=302;[_bigScrollViewaddSubview:_scrollView3];[_scrollView3release];self.theEntireRaidersVC=[[TheEntireRaidersViewControlleralloc]init];[_scrollView1addSubview:_theEntireRaidersVC.view];[_theEntireRaidersVC.viewrelease];self.blockTheDoorVC=[[BlockTheDoorViewControlleralloc]init];[_scrollView2addSubview:_blockTheDoorVC.view];[_blockTheDoorVCrelease];self.sincerityTestVC=[[SincerityTestViewControlleralloc]init];[_scrollView3addSubview:_sincerityTestVC.view];[_sincerityTestVCrelease];3.4故事3.4.1精彩故事圖功能:瀏覽其他新人發(fā)布分享的浪漫愛(ài)情故事,婚禮現(xiàn)場(chǎng),及點(diǎn)點(diǎn)滴滴的生活記錄圖提供的篩選方式有:默認(rèn)排序,收藏最多,作品最多,可以根據(jù)自己的習(xí)慣喜好去請(qǐng)求,鏈接,瀏覽精彩的故事技術(shù)實(shí)現(xiàn):封裝的基礎(chǔ)類(lèi):TableBaseViewController,KWPopoverView,AFNetworking,UIImageView,UILabel,UIButton,delegate傳值代碼:-(void)getNewData{[_wheelstartAnimating];_pageNum=1;[selfloadDatabyPageNumber:_pageNum];}-(void)loadMoreData{_pageNum++;[selfloadDatabyPageNumber:_pageNum];}-(void)loadDatabyPageNumber:(NSInteger)aPageNumber{///stories.json?page=1&sort=1&month=0//NSString*url=[NSStringstringWithFormat:@"%@?page=%d&sort=1",STORY_URL,aPageNumber];AFHTTPRequestOperationManager*manager=[[AFHTTPRequestOperationManageralloc]initWithBaseURL:[NSURLURLWithString:STORY_URL]];[manager.responseSerializersetAcceptableContentTypes:[NSSetsetWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain",nil]];NSDictionary*dic=@{@"page":[NSNumbernumberWithInteger:aPageNumber],@"sort":[NSStringstringWithFormat:@"%@",sort],@"month":[NSNumbernumberWithInt:0]};[managerGET:STORY_URLparameters:dicsuccess:^(AFHTTPRequestOperation*operation,idresponseObject){[selfdataRecivedSourcessful:responseObject];}failure:^(AFHTTPRequestOperation*operation,NSError*error){}];}-(void)dataRecivedSourcessful:(NSDictionary*)dic{if(_isReloadData){[_dataArrayremoveAllObjects];}NSArray*storysArray=[dicobjectForKey:@"stories"];for(NSDictionary*storysDicinstorysArray){Story*story=[[Storyalloc]initWithDictionary:storysDic];[self.dataArrayaddObject:story];[storyrelease];}[self.tableViewreloadData];intcurrentPage=[[dicobjectForKey:@"current_page"]intValue];inttotalPage=[[dicobjectForKey:@"total_pages"]intValue];if(currentPage<totalPage){_isHaveMoreData=YES;}else{_isHaveMoreData=NO;}[selffinishReloadingData];}-(void)finishReloadingData{[_wheelstopAnimating];[superfinishReloadingData];if(_isHaveMoreData){[selfsetFooterView];}else{[selfremoveFooterView];}}#pragmamark-Tableviewdatasource-(NSInteger)tableView:(UITableView*)tableViewnumberOfRowsInSection:(NSInteger)section{return[self.dataArraycount];}-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*identifier=@"cell";StoryCell*cell=[tableViewdequeueReusableCellWithIdentifier:identifier];if(!cell){cell=[[[StoryCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:identifier]autorelease];}Story*story=[self.dataArrayobjectAtIndex:indexPath.row];cell.story=story;returncell;}-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath{StoryDetailViewController*storyDetailVC=[[StoryDetailViewControlleralloc]init];storyDetailVC.hidesBottomBarWhenPushed=YES;Story*story=[self.dataArrayobjectAtIndex:indexPath.row];storyDetailVC.storys=story;NSLog(@"*********%@",storyDetailVC.storys.ID);//storyDetailVC.picUrl=story.picUrl;storyDetailVC.sectionTitle=story.title;[self.navigationControllerpushViewController:storyDetailVCanimated:YES];[storyDetailVCrelease];}-(void)enterDreamWorks{DreamWorksViewController*dreamWorksVC=[[DreamWorksViewControlleralloc]init];[self.navigationControllerpushViewController:dreamWorksVCanimated:YES];[dreamWorksVCrelease];}-(void*)createLabelWithRect:(CGRect)aRectfont:(UIFont*)aFonttext:(NSString*)aTexttextColor:(UIColor*)aColor{UILabel*label=[[UILabelalloc]initWithFrame:aRect];label.font=aFont;[labelsetTextColor:aColor];label.text=aText;[self.viewaddSubview:label];return[labelautorelease];}-(void)dealloc{self.aimageView=nil;self.defaultView=nil;self.ID=nil;self.wheel=nil;[superdealloc];}-(id)initWithStyle:(UITableViewCellStyle)stylereuseIdentifier:(NSString*)reuseIdentifier{self=[superinitWithStyle:stylereuseIdentifier:reuseIdentifier];if(self){self.aImageView=[[UIImageViewalloc]initWithFrame:CGRectMake(k_LEFT,5,k_WIDTH,k_IMAGE_HEIGHT)];_aImageView.userInteractionEnabled=YES;[selfaddSubview:_aImageView];[_aImageViewrelease];self.aView=[[UIViewalloc]initWithFrame:CGRectMake(240,_aImageView.bottom-40,60,25)];_aView.layer.cornerRadius=10;_aView.backgroundColor=[UIColorblackColor];_aView.alpha=0.5;[_aImageViewaddSubview:_aView];self.collectButton=[UIButtonbuttonWithType:UIButtonTypeSystem];_collectButton.userInteractionEnabled=YES;[_collectButtonsetBackgroundImage:[UIImageimageNamed:@"barUncollect.png"]forState:UIControlStateNormal];_collectButton.frame=CGRectMake(250,_aImageView.bottom-28,21,21);_collectButton.tag=100;[_collectButtonaddTarget:selfaction:@selector(collectStory:)forControlEvents:UIControlEventTouchUpInside];[_aImageViewaddSubview:_collectButton];self.collectLabel=[[UILabelalloc]initWithFrame:CGRectMake(_collectButton.right+6,_aImageView.bottom-25,50,20)];_collectLabel.font=[UIFontsystemFontOfSize:13];_collectLabel.backgroundColor=[UIColorclearColor];_collectLabel.textColor=[UIColorwhiteColor];[selfaddSubview:_collectLabel];[_collectLabelrelease];self.storyLabel=[[UILabelalloc]initWithFrame:CGRectMake(k_LEFT,_aImageView.bottom+5,k_WIDTH,200)];_storyLabel.backgroundColor=[UIColorwhiteColor];_storyLabel.font=[UIFontsystemFontOfSize:k_FONT];_storyLabel.numberOfLines=0;[selfaddSubview:_storyLabel];[_storyLabelrelease];}returnself;}-(void)collectStory:(UIButton*)button{_story.isSave=YES;DetailStory*detailStory=[[DetailStoryalloc]init];detailStory.picUrl=self.picurl;BOOLb=[AppDataHandelinsertPhoto:detailStory];NSLog(@"%@",b?@"YES":@"NO");if(b==YES){self.collectLabel.text=[NSStringstringWithFormat:@"%d",[_story.priseCountintValue]+1];self.seccessCollect=[[UIAlertViewalloc]initWithTitle:@"收藏提示"message:@"收藏成功!"delegate:selfcancelButtonTitle:nilotherButtonTitles:nil,nil];[_seccessCollectshow];[_seccessCollectrelease];[NSTimerscheduledTimerWithTimeInterval:1target:selfselector:@selector(collectSuccess)userInfo:selfrepeats:YES];//[buttonsetBackgroundImage:[UIImageimageNamed:@"barCollected.png"]forState:UIControlStateNormal];}else{self.collectLabel.text=[NSStringstringWithFormat:@"%d",[_story.priseCountintValue]];self.failedCollect=[[UIAlertViewalloc]initWithTitle:@"收藏提示"message:@"取消收藏成功!"delegate:selfcancelButtonTitle:nilotherButtonTitles:nil,nil];[_failedCollectshow];[_failedCollectrelease];[NSTimerscheduledTimerWithTimeInterval:1target:selfselector:@selector(collectFailed)userInfo:selfrepeats:YES];//[buttonsetBackgroundImage:[UIImageimageNamed:@"barUncollect.png"]forState:UIControlStateNormal];}}-(void)setStory:(DetailStory*)story{if(_story!=story){[_storyrelease];_story=[storyretain];}self.picurl=story.picUrl;self.storyLabel.text=story.description;self.collectCount=[story.priseCountintValue];self.collectLabel.text=[NSStringstringWithFormat:@"%d",_collectCount];if(story.isSave){[_collectButtonsetBackgroundImage:[UIImageimageNamed:@"barCollected.png"]forState:UIControlStateNormal];self.collectLabel.text=[NSStringstringWithFormat:@"%d",[story.priseCountintValue]+1];}/*NSDictionary*dic=[NSDictionarydictionaryWithObjectsAndKeys:[UIFontsystemFontOfSize:k_FONT],NSFontAttributeName,nil];CGRectrect=[story.descriptionboundingRectWithSize:CGSizeMake(k_WIDTH,0)options:NSStringDrawingUsesLineFragmentOriginattributes:diccontext:nil];*/CGSizesize=[story.descriptionsizeWithFont:[UIFontsystemFontOfSize:k_FONT]constrainedToSize:CGSizeMake(k_WIDTH,200)lineBreakMode:NSLineBreakByTruncatingHead];if([story.picUrlisKindOfClass:[NSNullclass]]&&[story.widthisEqualToString:@"0"]&&[story.heightisEqualToString:@"0"]){[self.aImageViewremoveFromSuperview];[self.aViewremoveFromSuperview];[self.collectButtonremoveFromSuperview];[self.collectLabelremoveFromSuperview];_storyLabel.frame=CGRectMake(k_LEFT,15,k_WIDTH,size.height);}elseif([story.descriptionisEqualToString:@""]){_storyLabel.frame=CGRectMake(0,0,0,0);[self.aImageViewsetImageWithURL:[NSURLURLWithString:story.picUrl]];self.aImageView.frame=CGRectMake(k_LEFT,5,k_WIDTH,[story.heightintValue]*300/[story.widthintValue]);self.aView.frame=CGRectMake(_aView.left,_aImageView.bottom-35,_aView.width,_aView.height);self.collectButton.frame=CGRectMake(_collectButton.left,_aImageView.bottom-32,_collectButton.width,_collectButton.height);self.collectLabel.frame=CGRectMake(_collectButton.right+10,_aImageView.bottom-27,_collectLabel.width,_collectLabel.height);}else{[self.aImageViewsetImageWithURL:[NSURLURLWithString:story.picUrl]];self.aImageView.frame=CGRectMake(k_LEFT,5,k_WIDTH,[story.heightfloatValue]*300/[story.widthfloatValue]);self.aView.frame=CGRectMake(_aView.left,_aImageView.bottom-35,_aView.width,_aView.height);self.collectButton.frame=CGRectMake(_collectButton.left,_aImageView.bottom-32,_collectButton.width,_collectButton.height);self.collectLabel.frame=CGRectMake(_collectButton.right+10,_aImageView.bottom-27,_collectLabel.width,_collectLabel.height);_storyLabel.frame=CGRectMake(_storyLabel.frame.origin.x,_aImageView.bottom+5,k_WIDTH,size.height+5);}}+(CGFloat)cellHeight:(DetailStory*)storycell:(DetailStoryCell*)cell{/*NSDictionary*dic=[NSDictionarydictionaryWithObjectsAndKeys:[UIFontsystemFontOfSize:k_FONT],NSFontAttributeName,nil];CGRectrect=[story.descriptionboundingRectWithSize:CGSizeMake(k_WIDTH,0)options:NSStringDrawingUsesLineFragmentOriginattributes:diccontext:nil];*/CGSizesize=[story.descriptionsizeWithFont:[UIFontsystemFontOfSize:k_FONT]constrainedToSize:CGSizeMake(k_WIDTH,200)lineBreakMode:NSLineBreakByTruncatingHead];if([story.descriptionisEqualToString:@""]){[cell.storyLabelremoveFromSuperview];cell.aImageView.frame=CGRectMake(k_LEFT,5,k_WIDTH,[story.heightfloatValue]*300/[story.widthfloatValue]);return10+cell.aImageView.frame.size.height;}elseif([story.widthisEqualToString:@"0"]&&[story.heightisEqualToString:@"0"]){returnsize.height+30;}else{cell.aImageView.frame=CGRectMake(k_LEFT,5,k_WIDTH,[story.heightfloatValue]*300/[story.widthfloatValue]);returnsize.height+5*4+cell.aImag
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 三年級(jí)口算題集1000道
- 三年級(jí)口算題庫(kù)大全1000道
- 三年級(jí)口算題目匯編1000道
- 加工合同范本英文
- 主人和仆人合同范本
- 倉(cāng)庫(kù)空調(diào)直銷(xiāo)合同范本
- 廠內(nèi)安裝監(jiān)控合同范本
- 2025陜西省建筑安全員B證考試題庫(kù)及答案
- 單位電改造合同范本
- 個(gè)人交易房合同范本
- 國(guó)有土地上房屋征收與補(bǔ)償條例 課件
- 安全文明施工管理(EHS)方案(24頁(yè))
- 水廠項(xiàng)目基于BIM技術(shù)全生命周期解決方案-城市智慧水務(wù)講座課件
- 幼兒園繪本:《閃閃的紅星》 紅色故事
- 三年級(jí)學(xué)而思奧數(shù)講義.doc
- 投標(biāo)人基本情況一覽表格
- 鐵路建設(shè)項(xiàng)目施工企業(yè)信用評(píng)價(jià)辦法(鐵總建設(shè)〔2018〕124號(hào))
- 叉形件加工設(shè)計(jì)與分析論文
- 高強(qiáng)螺栓質(zhì)保書(shū)
- 市政工程施工進(jìn)度網(wǎng)絡(luò)圖
- 鄒縣1000MW#7機(jī)組最大出力試驗(yàn)報(bào)告
評(píng)論
0/150
提交評(píng)論