《SDEASYCAM 手机APP软件 前30页代码.docx》由会员分享,可在线阅读,更多相关《SDEASYCAM 手机APP软件 前30页代码.docx(29页珍藏版)》请在优知文库上搜索。
1、#importMKHorizMenu.h#defineKButtonBaseTag10000#defineKLeftOffset5implemeniationMKHorizMenuSyntheSiZetitles=Jitles;synthesizeSelectedlmage-_selectedlmage;synthesizeitemSelectedDelegate;SyZheSiZedataSource:SynmeSiZeitemCount=JtemCount;-(void)awakeFromNib(self.bonces=YES;self.scrollEnabled=YES;self.alw
2、aysBounceHorizontalYES;self.alwaysBounceVertical=NO;Self.ShowsHorizontaiscroIIIndicator=NO;Self-ShowsverticaiscrolllndicatorNO;SeIfreloadData;-(void)TeIoadSoundBtn()-(void)reloadData(NSArray*viewsToRemove-selfsubviews;for(UIView*vinViewsToRemove)vremoveFromSperview);)SeIfJtemCount=dataSourcenumberOf
3、ltemsForMenu:self;self.backgroundColor=dataSourcebackgroundColorForMenuzself;/Self.Selectedlmage=dataSourceSelecteclltemImageForMenuiseIf;UIFont*buttonFont=(UIFontboldSystemFonlOfSizer15;intbultoPadding-5;inttag=KButtonBaseTag;intxPosRLeftOffset;CGFIoatbtnTotalWidth=O.Of;for(inti=O;iself.itemCount;i
4、+)Ullmage*bglmg=UllmageimageNamed:dataSourcehorizMenu:selftitleForltemAtlndex:i;btnTotalWidth+=bgImg.size.width;if(i3)NSLog(OK);)计算左右变距CGFIoattotalLen=(self.itemCount-1)*buttonPadding+btnTotalWidth;CGFIoatleft-(self.superview.frame.size.width-totalLe)2;f(leftXO)IeftX=XPos;XPos=IeftX;for(intiO;iself.
5、itemCount;i+)(NSString,title=UIButton*customButtonUIButtonbuttonWithTypeUIBultonTypeCuslom;CustomButtonsetTitle:titleforState:UIControlStateNormal;CustomButtonJitleLabeLfont=buttonFont;Ullmage*bglmg=UllmageimageNamed:dataSourcehorizMenu:selftitleForltemAtlndex:i:(CustomButtonSetBackgroundImagerbgImg
6、forState:UIcontroIStateNormaI;CustomButtonsetBackgroundlmage:UllmageimageNamedJdatasourceselectedltemlmageForMenuiseIfitemAtIndexiiforState:UIcontroIStateSeIected;(CustomButtonsetBackgroundlmage:UllmageimageNamed:dataSourceselectedltemlmageForMenu:selfitemAtlndex:iforState:IJlContrOIStaIeHighlighted
7、;CustomButtonJag=tag+;CustomButtonaddTarget:selfaction:selector(buttonTapped:)forControlEvents:UIControlEventTouchUplnside;CustomButtonaddTarget:selfaction:selector(buttonTouchDown:)forControlEvents:UIControlEventTouchDown:CustomButtonJrame-CGRectMake(xPos,3,bglmg.size.width,38):Pos+=bglmg.size.widt
8、h;if(i1self.itemCount)xPos+=buttonPadding;sefaddSubviewxustomButto;xPos+=IeftX:if(xPosself.frame.size.width)xPos-self.frame.size.width;self.cotentSize=CGSizeMake(Pos,self.frame.size.height);(SelflayoutSubviews;)#import#import#importCameraMultiLiveViewController.h#import#importVloTCamera/ImageBufflnf
9、o.h#import#import#importAppDelegate.h#import*MyNavViewController.himport-UIDevice+Device,h#defineDEF_WAIT4ST0PSH0W_TIME250#CIefineDEF-SplitViewNm4#defineDEFReTryConnectlnterval25*1000#defineDEF_ReTryTimes10interfaceCameraMultiLiveViewController()MyCamera*mDummyCam:NSMutabIeArray,marlmg-Vdo:intmReTry
10、TimesArrayDEFSpIitViewNum;UnsignedintmnLastReTryTickArray(DEF-SplitViewNum;)end(implementationCameraMultiLiveviewControIIerSynmeSiZebStopShowCompletedLock;synthesizeSelectedAudioMode;SyntheSiZecamNeedReconnect;synthesizeSeIectCameraArray;synthesizeCameraArray;SyntheSiZeChanneIArray;#PragmamarkMethod
11、s-(Ullnterfaceorientation)PreferredlnterfaceorienlationForPresentation(returnUllntertaceOrientationLandscapeLeft;)(CGRect)ZoomRectForscroliviewxuiscroIIView*)_scrollViewwithScale:(CGFIoat)scaleWithCenter:(CGPoint)CenterCGReclzoomRect:HThezoomrectisinthententviewsordinates.HAtazoomscaleof1.0.itwouldb
12、ethesizeofIhe/imageScrollView,sbounds.HAsthezoomscaledecreases,somorententisvisible,hesizeoftherectgrows.ZoomReCISiZe.height=_scrollView.frame.size.height/scale;zoomRect.size.width=scrollView.frame.size.width/scale;Uchooseanoriginsoastogettherightcenter.zoomRct.origin.x=center.x-(zoomRect.size.width
13、/2.0);zmRect.origin.y=center.y-(zoomRect.size.height/2.0);returnzoomRect;)-(Ullmage*)getUllmage:(char*)buffWidth:(NSInteger)WidthHeight:(NSInteger)heightCGDataProviderRefprovider=CGDataPrOViderereateWithData(NULL,buff,width*height*3tNULL);CGcoIorSpaceRefcolorspace=CGColorSpaceCreatDeviceRGB():CGlmag
14、eRefimgRef=CGlmageCreat(width,height,8l24,width*3,colorSpace1kCGBitmapByteOrderDefaut,provider,NULL,true,kCGRenderingIntentDefauIt);Ullmage*img=UIImageimageWithCGImagejmgRef;f(imgRef!=nil)(CGImageRelease(imgRef);imgRef=nil;if(colorSpace!=nil)CGcolorspaceRelease(CoIorSpace);lorSpace=nil;f(providerlnil)CGDataPrOViderReleaSe(ProVider);provider-nil;returnimgcopyautorelease;)-(void)camStopShowr(int)algnoreldxisCamStopShow=YES:for(inti-O;iDEF_SplitViewNum;i+)if(i=algnored)continue;MyCamera*testCamera=(CameraArrayobjectAtIndexzi;if(testCamera.id!=nil