해상도가 3.5인치 비율의 해상도인지 그 외 해상도인지 확인

#define isLongScreen ([UIScreen mainScreen].bounds.size.height==568 || [UIScreen mainScreen].bounds.size.width==568)


반응형

UINavigation 의 push 애니메이션 효과를 코드로 적용하는 방법.

#import <QuartzCore/QuartzCore.h>

-----------------------------------------------------

- (void)showNextView {
	[self.view addSubview:nextView];
	CATransition *animation = [CATransition animation];
	[animation setDuration:0.5];
	[animation setType:kCATransitionPush];
	[animation setSubtype:kCATransitionFromRight];
	[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
	[[self.view layer] addAnimation:animation forKey:@"SlideView"];
}

- (void)hideNextView {
	[nextView removeFromSuperview];
	CATransition *animation = [CATransition animation];
	[animation setDuration:0.5];
	[animation setType:kCATransitionPush];
	[animation setSubtype:kCATransitionFromLeft];
	[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
	[[self.view layer] addAnimation:animation forKey:@"SlideView"];
}


반응형



UITextField *textField;
UITextField *textField2;

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Username and password" 
              message:@"\n\n\n" // 중요!! 칸을 내려주는 역할을 합니다.
             delegate:self 
             cancelButtonTitle:@"Cancel"
             otherButtonTitles:@"Enter", nil];


 textField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 50.0, 260.0, 25.0)]; 
 [textField setBackgroundColor:[UIColor whiteColor]];
 [textField setPlaceholder:@"username"];
 [alert addSubview:textField]; 

 textField2 = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 85.0, 260.0, 25.0)]; 
 [textField2 setBackgroundColor:[UIColor whiteColor]];
 [textField2 setPlaceholder:@"password"];
 [textField2 setSecureTextEntry:YES];
 [alert addSubview:textField2];

  // AlertView의 위치를 이동 시켜 줌.
 [alert setTransform:CGAffineTransformMakeTranslation(0.0, 110.0)];
 [alert show];
 [alert release];

 // textfield에 커서를 보내고 키보드를 표시 해 줌.
 [textField becomeFirstResponder];

반응형