軟件開發(fā)(游戲方向) 畢業(yè)實訓(xùn)報告-秀婚禮_第1頁
軟件開發(fā)(游戲方向) 畢業(yè)實訓(xùn)報告-秀婚禮_第2頁
軟件開發(fā)(游戲方向) 畢業(yè)實訓(xùn)報告-秀婚禮_第3頁
軟件開發(fā)(游戲方向) 畢業(yè)實訓(xùn)報告-秀婚禮_第4頁
軟件開發(fā)(游戲方向) 畢業(yè)實訓(xùn)報告-秀婚禮_第5頁
已閱讀5頁,還剩41頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

PAGEI摘要隨著人們生活節(jié)奏的加快,一部分未婚人士沒有足夠的時間去專門為自己的婚禮做準(zhǔn)備,<<秀婚禮>>這個APP能讓這部分人方便地準(zhǔn)備婚禮,市場需求廣闊。秀婚禮共有5大模塊:1.購物2.搶拍3.戲婚禮4.故事5.我給用戶提供全面的婚禮信息,讓用戶方便完美地”結(jié)婚”.關(guān)鍵詞:婚禮;購物目錄摘要 II第1章項目分析 11.1項目背景 11.2工程進度計劃 11.3運行環(huán)境 1第2章結(jié)構(gòu)設(shè)計 2第3章實現(xiàn) 33.1購物 33.1.1商品 33.1.2排序 63.1.3分類 73.1.4寶貝詳情 83.1.5分享 93.1.6購買商品 103.2搶拍 113.2.1搶拍列表 113.2.2搶拍詳情 143.3戲婚禮 193.4故事 223.4.1精彩故事 223.4.2故事詳情 313.4.3夢工廠 333.4.4商家 373.4.5地圖 383.5我的 393.5.1登錄 393.5.2個人信息 403.5.3收藏 41第4章結(jié)束語 42附錄:主要源程序 43姓名:常小賓論文題目:秀婚禮PAGE1第1章項目分析1.1項目背景隨著科技的發(fā)展和社會的進步,互聯(lián)網(wǎng)已成為人們密不可分的一部分,網(wǎng)上購物成為潮流,手機的信息推廣逐步加大,出于方便人們和推廣的目的,我們團隊開發(fā)出這款秀婚禮.讓即將結(jié)婚的人能隨時隨地的為自己的婚禮做準(zhǔn)備,設(shè)計一個完美的婚禮.1.2工程進度計劃開始前兩天設(shè)計界面架構(gòu),接下來一周半實現(xiàn)分工后的各自界面,再花一周的時間進行整合上項。1.3運行環(huán)境可用操作系統(tǒng):Mac操作系統(tǒng)iphone移動設(shè)備

第2章結(jié)構(gòu)設(shè)計本著簡單美觀的理念,項目采用了UITablebarController(多視圖控制器)來布局,UITablebarController管理著5個UIViewcontroller(視圖控制器),每個UIViewcontroller完成一個模塊.第3章實現(xiàn)上面已經(jīng)把我們的設(shè)計理念和所用技術(shù),下面我介紹下各個模塊的作用以及功能的實現(xiàn)(只介紹負(fù)責(zé)部分).3.1購物3.1.1商品圖3.1.1購物頁面主要用到的UI控件UINavigationController,UITabBarController來控制,整個的頁面的效果采用UICollectionView控件做出來的,根據(jù)圖片寬高返回來的數(shù)據(jù)自適應(yīng)大小的瀑布流效果每個圖片右下方的位置都有一個UIButton,用戶在瀏覽商品的同時,可以根據(jù)自己的喜好對自己喜歡的商品進行收藏,在后邊我的收藏里可以查看自己收藏的商品圖片-(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ù)商品的受追捧度來區(qū)分商品,我們做出來根據(jù)”熱度”這一條件對商品進行了區(qū)分排序效果圖整體上是一個UIView,上邊一個裁剪好的image添加在UIImageView上,在添加一個UILable控件,在整體的UIImageView上,最后關(guān)聯(lián)手勢方法,排序分為所有商品默認(rèn)排序和按收藏?zé)岫冗M行排序3.1.3分類圖3.1.3用戶在瀏覽商品的同時也可以對商品進行分類商品分類實現(xiàn)了按婚紗,禮服,婚鞋,配飾,首飾,婚慶用品,家居禮品,和全部商品的八個分類3.1.4寶貝詳情圖3.1.41.點擊購物頁面圖片推送到寶貝詳情頁面2.商品的詳細(xì)介紹,商品簡介,商品價格,并且在此頁面能夠收藏商品和分享商品,點擊去購買,能夠推送到第三方鏈接的淘寶購物頁面3.1.5分享圖3.1.5分享頁面的實現(xiàn)利用了第三方shareSDK,能夠提供很多的分享平臺,我們只實現(xiàn)了新浪微博,騰訊微博,網(wǎng)易微博,搜狐微博,人人網(wǎng)的對該商品的分享功能!3.1.6購買商品圖3.1.6用戶點擊購買商品,能夠自動跳轉(zhuǎn)到鏈接淘寶界面的第三方的webView頁面,用戶可以自行選擇購買商品和瀏覽同類的其它商品3.2搶拍3.2.1搶拍列表圖3.2.1搶拍模塊主界面提供了了搶拍商品列表,本身是一個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ù)(兩個日期)來確定搶拍商品的狀態(tài),即將開始,搶拍中,結(jié)束(由于后臺原因部分狀態(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"];//拍賣中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"];//即將開始if(self.beginButton){[_beginButtonremoveFromSuperview];}self.beginButton=[[UIButtonalloc]initWithFrame:CGRectMake(200,0,90,30)];_beginButton.userInteractionEnabled=NO;_beginButton.layer.cornerRadius=5;[_beginButtonsetTitle:@"即將開始"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搶拍詳情圖搶拍詳情界面提供了具體某個商品的當(dāng)前狀態(tài),圖片介紹,原價現(xiàn)價,品牌,以及更多地詳細(xì)信息.下邊有搶拍按鈕,狀態(tài)允許點擊進入寶貝搶拍界面.搶拍詳情界面本身是在UIViewcontroller上面添加了一個scrollView和一個view,view上面有兩個button,scrollView上面按照接口數(shù)據(jù)布局最后是一個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)時間控制-(void)changeTime{//NSLog(@"################");_endSinceNowTime=_endSinceNowTime-1;inttime3=_endSinceNowTime/1;((UILabel*)[self.viewviewWithTag:300]).font=[UIFontsystemFontOfSize:12];((UILabel*)[self.viewviewWithTag:300]).text=[NSStringstringWithFormat:@"距結(jié)束時間:%d時%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:@"距開始時間:%d時%d分%d秒",time4/3600,time4%3600/60,time4%3600%60];}//點擊立即搶拍進入下一個界面-(void)comToBuy_url//搶購{GoodsPictureViewController*buy_urlVC=[[GoodsPictureViewControlleralloc]init];buy_urlVC.picUrl=self.buy_url;[self.navigationControllerpushViewController:buy_urlVCanimated:YES];[buy_urlVCrelease];}圖點擊合作品牌view彈出品牌簡介視圖,(多的不做介紹)點擊淘寶圖片進入下一個界面-(void)comtoTaobao{//NSLog(@"@@@@@@@@@@@@@@@");GoodsPictureViewController*buy_taoBao=[[GoodsPictureViewControlleralloc]init];buy_taoBao.picUrl=self.buy_url;[self.navigationControllerpushViewController:buy_taoBaoanimated:YES];}圖scrollView上添加的viewcontroller有兩種自定義cell,一種cell加載一張圖片,另一種上除了布局外還在6個imageview上添加了輕拍手勢,點擊進入寶貝界面://手勢-(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戲婚禮就是一個segmentcontrol控制3個tableView,tableView上顯示相關(guān)文檔相關(guān)代碼:[superviewDidLoad];self.title=@"戲婚禮";self.navigationController.navigationBar.translucent=NO;//**********************配置當(dāng)前導(dǎo)航欄的按鈕self.navigationItem.rightBarButtonItem=[[[UIBarButtonItemalloc]initWithTitle:@"隨機"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(doRightItem)]autorelease];//**************sementControl************NSArray*title=@[@"整人攻略",@"擋門攻略",@"誠意考驗"];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ā)布分享的浪漫愛情故事,婚禮現(xiàn)場,及點點滴滴的生活記錄圖提供的篩選方式有:默認(rèn)排序,收藏最多,作品最多,可以根據(jù)自己的習(xí)慣喜好去請求,鏈接,瀏覽精彩的故事技術(shù)實現(xiàn):封裝的基礎(chǔ)類: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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論