IanMK2 Blog

UIAlertView와 비슷하다

- (IBAction)captureClicked:(id)sender{
UIActionSheet *ask = [[UIActionSheet alloc] initWithTitle:@"사진" delegate:self cancelButtonTitle:@"취소" destructiveButtonTitle:@"앨범에서 선택" otherButtonTitles:@"찍기",nil];
//other버튼에서 마지막에 nil로 하는거 잊지말자 가끔씩 깜빡하는데 콘솔봐도 에러메세지 안뜨고 삽질하기 쉽다.

ask.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[ask showInView:self.view];
[ask release];
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch(buttonIndex)
{
case 0:
[self getPhotos];
break;
case 1:
break;

}
}


삽질하지말고 액션시트 델리게이트정도는 추가하자
Posted by IanMK2

헤더에 UINavigationController delegate와 UIImagePickerController Delegate를 추가하고
- (IBAction)getPhotos
{
UIImagePickerController *picker = [[[UIImagePickerController alloc]init] autorelease];
picker.delegate = self;
// picker.sourceType = UIImagePickerControllerSourceTypeCamera; //카메라로 찍어서 가져오기
// picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; //앨범에서 가져오기
[self presentModalViewController:picker animated:YES];
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
//img에 선택한사진
}


Posted by IanMK2

UIImageView * logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo.jpg"]];
logoView.contentMode = UIViewContentModeScaleToFill;
logoView.frame = CGRectMake(0, 0, 320, 480);

[UIView beginAnimations:nil context:NULL];   //여기부터
[UIView setAnimationDuration:2.0];
[window addSubview:logoView];
[logoView setAlpha:0.0]; //알파값을 0 으로 바꾸므로 페이드아웃효과가 남
[UIView commitAnimations];  //여기사이에 프로퍼티를 변경하면 애니메이션효과가 나타난다.






Posted by IanMK2