여러 하위 뷰가있는 앱에서 작업하고 있습니다.C4 카메라 캡처 -보기로 돌아갈 때의 문제
현재 4 개의 하위보기가 있습니다. 여기 그것은 C4Workspace 코드 (이 메인 작업은 또한 뷰
-(void)goToTakePhoto{
[takePhoto resetCounter];
[takePhoto setup];
C4Log(@"TakePhoto");
takePhoto.canvas.hidden=NO;
cropPhoto.canvas.hidden=YES;
assignLetter.canvas.hidden=YES;
alphabetView.canvas.hidden=YES;
}
-(void)goToCropPhoto{
C4Log(@"going to CropPhoto");
[cropPhoto displayImage:takePhoto.img];
[cropPhoto setup];
takePhoto.canvas.hidden=YES;
cropPhoto.canvas.hidden=NO;
assignLetter.canvas.hidden=YES;
alphabetView.canvas.hidden=YES;
}
-(void)goToAssignPhoto{
C4Log(@"AssignPhoto");
[assignLetter setup];
[assignLetter drawCurrentAlphabet:currentAlphabet];
[assignLetter drawCroppedPhoto:cropPhoto.croppedPhoto];
takePhoto.canvas.hidden=YES;
cropPhoto.canvas.hidden=YES;
assignLetter.canvas.hidden=NO;
alphabetView.canvas.hidden=YES;
}
-(void)goToAlphabetsView{
C4Log(@"AlphabetsView");
[alphabetView setup];
[alphabetView drawCurrentAlphabet:assignLetter.currentAlphabet];
takePhoto.canvas.hidden=YES;
cropPhoto.canvas.hidden=YES;
assignLetter.canvas.hidden=YES;
alphabetView.canvas.hidden=NO;
}
제보기 튜토리얼 매우 유사 사진 촬영 간의 전환은 다음과 같은 기능을 갖는다
//TakePhoto
takePhoto= [TakePhoto new];
takePhoto.canvas.frame=CGRectMake(0, 0, self.canvas.width, self.canvas.height);
takePhoto.canvas.userInteractionEnabled = YES;
[takePhoto transferVariables:1 topBarFromTop:TopBarFromTopDefault topBarHeight:TopNavBarHeightDefault bottomBarHeight:BottomBarHeightDefault navBarColor:navBarColorDefault navigationColor:navigationColorDefault typeColor:typeColorDefault fatFont:fatFontDefault normalFont:normalFontDefault iconTakePhoto:iconTakePhoto iconClose:iconClose iconBack:iconBack];
[takePhoto setup];
[takePhoto cameraSetup];
[self.canvas addSubview:takePhoto.canvas];
//CropPhoto
cropPhoto=[CropPhoto new];
cropPhoto.canvas.frame=CGRectMake(0, 0, self.canvas.width, self.canvas.height);
cropPhoto.canvas.userInteractionEnabled=YES;
[cropPhoto transferVariables:1 topBarFroTop:TopBarFromTopDefault topBarHeight:TopNavBarHeightDefault bottomBarHeight:BottomBarHeightDefault navBarColor:navBarColorDefault navigationColor:navigationColorDefault typeColor:typeColorDefault overlayColor:overlayColorDefault fatFont:fatFontDefault normalFont:normalFontDefault iconClose:iconClose iconBack:iconBack iconOk:iconOk];
[self.canvas addSubview:cropPhoto.canvas];
cropPhoto.canvas.hidden= YES;
//AssignPhoto
assignLetter=[AssignLetter new];
assignLetter.canvas.frame=CGRectMake(0, 0, self.canvas.width, self.canvas.height);
assignLetter.canvas.userInteractionEnabled=YES;
[assignLetter transferVariables:1 topBarFroTop:TopBarFromTopDefault topBarHeight:TopNavBarHeightDefault bottomBarHeight:BottomBarHeightDefault navBarColor:navBarColorDefault navigationColor:navigationColorDefault typeColor:typeColorDefault highlightColor:highlightColorDefault fatFont:fatFontDefault normalFont:normalFontDefault iconClose:iconClose iconBack:iconBack iconOk:iconOk iconSettings:iconSettings];
[self.canvas addSubview:assignLetter.canvas ];
assignLetter.canvas.hidden=YES;
//AlphabetView
alphabetView=[AlphabetView new];
alphabetView.canvas.frame= CGRectMake(0, 0, self.canvas.width, self.canvas.height);
alphabetView.canvas.userInteractionEnabled=YES;
[alphabetView transferVaribles:1 topBarFromTop:TopBarFromTopDefault topBarHeight:TopNavBarHeightDefault bottomBarHeight:BottomBarHeightDefault navBarColor:navBarColorDefault navigationColor:navigationColorDefault typeColor:typeColorDefault darkenColor:darkenColorDefault fatFont:fatFontDefault normalFont:normalFontDefault iconClose:iconClose iconBack:iconBack iconMenu:iconMenu iconTakePhoto:iconTakePhoto iconAlphabetInfo:iconAlphabetInfo iconShareAlphabet:iconShareAlphabet iconWritePostcard:iconWritePostcard iconMyPostcards:iconMyPostcards iconMyAlphabets:iconMyAlphabets];
[self.canvas addSubview:alphabetView.canvas];
alphabetView.canvas.hidden=YES;
//the methods to listen for from all other canvasses
[self listenFor:@"goToTakePhoto" andRunMethod:@"goToTakePhoto"];
[self listenFor:@"goToCropPhoto" andRunMethod:@"goToCropPhoto"];
[self listenFor:@"goToAssignPhoto" andRunMethod:@"goToAssignPhoto"];
[self listenFor:@"goToAlphabetsView" andRunMethod:@"goToAlphabetsView"];
들을 설정하는 방법 사진을 찍을 버튼이 탭되었을 때 항상 두 번 알림을 보냈 음을 알았 기 때문에 카메라의 재설정 카운터를 추가했습니다. 난 다시 이미지에서 이동하고있어 만약 내가 다시 C4Label에서 해당보기로하지만 탐색 할
-(void) setup{
photoButtonImage=iconTakePhoto;
photoButtonImage.height=45;
photoButtonImage.width=90;
photoButtonImage.center=CGPointMake(self.canvas.width/2, self.canvas.height-bottomBarHeight/2);
[self.canvas addImage:photoButtonImage];
//gestures to take the photo
[self listenFor:@"touchesBegan" fromObject:photoButtonImage andRunMethod:@"captureImage"];
[self numberOfTouchesRequired:1 forGesture:@"capture"];
[self listenFor:@"imageWasCaptured" fromObject:cam andRunMethod:@"goToCropPhoto"];
}
-(void)cameraSetup{
cam = [C4Camera cameraWithFrame:CGRectMake(0,topBarFromTop+topBarHeight, self.canvas.width, self.canvas.height-(topBarHeight+bottomBarHeight+topBarFromTop))];
cam.cameraPosition = CAMERABACK;
[self.canvas addCamera:cam];
[cam initCapture];
counter=0;
}
-(void) captureImage{
[cam captureImage];
C4Log(@"capturing image");
}
-(void)resetCounter{
counter=0;
}
이만큼 잘 작동합니다. 비록 두 함수를 만질 때 똑같은 함수를 실행하고 있습니다.
//image as navigation element
takePhotoButton=iconTakePhoto;
takePhotoButton.width=60;
takePhotoButton.center=CGPointMake(takePhotoButton.width/2+5, bottomNavBar.center.y);
[self.canvas addImage:takePhotoButton];
[self listenFor:@"touchesBegan" fromObject:takePhotoButton andRunMethod:@"goToTakePhoto"];
//label as navigation element
takePhoto=[C4Label labelWithText:@"take Photo" font: normalFont];
takePhoto.center=CGPointMake(self.canvas.width-(takePhoto.width/2+5), topNavBar.center.y);
[self.canvas addLabel:takePhoto ];
[self listenFor:@"touchesBegan" fromObject:takePhoto andRunMethod:@"goToTakePhoto"];
을 그리고 마지막으로이 내가 지금 라벨을 사용하여 작동 할 수 있지만 너무 좋을 것 테 알림을
-(void) goToTakePhoto{
C4Log(@"goToTakePhoto");
[self removeFromView]; //removes the currently displayed items from being displayed
[self postNotification:@"goToTakePhoto"];
}
을 보내는 내부보기 기능입니다 : 은 다음과 같습니다 C4Image를 버튼으로 사용하려면 .... 아이디어가 있으십니까? Github에서에 전체 코드를 사용할 수 : http://github.com/susemiessner/Urban-Alphabets/tree/master/urbanAlphabetsII
프로젝트를 컴파일하기가 어렵지만 github repo에는 이미지와 다른 파일이 누락되어 있습니다. 'takePhoto' 라벨 대신'fromObject : theImageYouWantToUse'를 할 수 있습니까? –
그게 내가 여기서하고있는거야. '[self listenFor : @ "touchesBegan"fromObject : takePhotoButton andRunMethod : @ "goToTakePhoto"];' 그리고 그것은 단지 다음 화면에서 사진을 찍기위한 단추를 즉시 발사합니다. – suMi