///////////////////////////////////////////////////
// Table View Template
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 5; // return [listData count];
}
//Cell을정의 (Cell을돌려줌)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//cell id가있어야함
static NSString *cIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cIdentifier];
//셀 값이 없고 재활용 가능한 셀이면 재활용하고 아니면 다시만든다.
if(cell == nil)
{
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cIdentifier]autorelease];
if(indexPath.row == 0)
{
cell.textLabel.text =@"First Row";
else
{
cell.textLabel.text =@"Other Cell";
return cell;
IBOutlet UIPickerView *picker;
NSMutableArray *pickData;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
pickData = [[NSMutableArray alloc]init];
[pickData addObject:@"1빠"];
[pickData addObject:@"2빠"];
[pickData addObject:@"3빠"];
[pickData addObject:@"4빠"];
[pickData addObject:@"5빠"];
[pickData addObject:@"6빠"];
[super viewDidLoad];
// Picker View 개수
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
// Picker View의 데이터 개수
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return [pickData count];
}
// delegate
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
// NSLog(@"value : %i", row);
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
// 선택되었을시의 처리
//label.text = [pickDataobjectAtIndex:row];
rootView *rView = [[rootView alloc]initWithNibName:@"rootView" bundle:nil];
UINavigationController *curNav = self.navigationController;
NewAccountView *viewControl = [[NewAccountView alloc]initWithNibName:@"NewAccountView" bundle:nil];
[curNav pushViewController:viewControl animated:YES];
UINavigationController *curNav = self.navigationController;
UINavigationController *curNav = self.navigationController;
@interface SecondView : UIViewController {
NSString *receiveData; // FirstView 에서 넘어올 데이터
}
- (void)viewDidLoad {
lbltext.text = receiveData;
[superviewDidLoad];
UINavigationController *sNav = self.navigationController;
SecondView *sView = [[SecondView alloc]initWithNibName:@"SecondView" bundle:nil];
sView.receiveData = textData.text;
[sNav pushViewController:sView animated:YES];
rootView *rView = [[rootViewalloc]initWithNibName:@"rootView"bundle:nil];
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"Clicked Button index : %i", buttonIndex);
}
-(IBAction)clickSimple
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"제목" message:@"내용을적으면됨" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK버튼", nil];
[alert show];
[alert release];
}
-(IBAction)clickMulti
{
UIAlertView *malert = [[UIAlertView alloc]initWithTitle:@"멀티제목" message:@"내용을적으셈" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK버튼", @"Cancel", nil];
[malert show];
[malert release];
{
NSLog(@"Action Sheet Index : %i\n", buttonIndex);
- (IBAction)clickActionSheet
{
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"제목"delegate:self cancelButtonTitle:@"취소" destructiveButtonTitle:@"포커스" otherButtonTitles:@"천재", @"위대함", nil];
[actionSheet showInView:[self view]];
[actionSheet release];
- (IBAction) segmentChange:(id)sender
{
NSLog(@"click Index: %i", [sender selectedSegmentIndex]);
- (IBAction) switchChange:(id)sender
{
UISwitch *tmpSwitch = (UISwitch*)sender;
if(tmpSwitch.isOn)
{
NSLog(@"On");
}
else
{
NSLog(@"Off");
}
}
- (IBAction) sliderChange:(id)sender
{
UISlider *tmpSlider = (UISlider *)sender;
NSLog(@"value : %f", tmpSlider.value);//0.0~1.0까지입니다.
- (IBAction) click3
{
nowProgress.progress = 1.0;
}- (IBAction)hiddenKeyboard
{
NSLog(@"hidden keyboard");
NSArray *subs = self.view.subviews;
id curView;
for(curView in subs)
{
if([curView conformsToProtocol:@protocol(UITextInputTraits)])
{
[curView resignFirstResponder];
}
}
}Modal *modalView = [[Modal alloc]initWithNibName:@"Modal" bundle:nil];
[self presentModalViewController:modalView animated:YES];LeftTurn *lrView = [[LeftTurnalloc]initWithNibName:@"LeftTurn" bundle:nil];
[UIView beginAnimations:@"left flip" context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRightforView:self.viewcache:YES];
[self.viewaddSubview:lrView.view];
[UIViewcommitAnimations];
[UIView beginAnimations:@"back"context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeftforView:self.view.superviewcache:YES];
[self.viewremoveFromSuperview];
PageFlip *crView = [[PageFlipalloc]initWithNibName:@"PageFlip"bundle:nil];
[UIViewbeginAnimations:@"page flip"context:nil];
[UIViewsetAnimationDuration:1.5];
[UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIViewsetAnimationTransition:UIViewAnimationTransitionCurlUpforView:self.viewcache:YES];
[self.viewaddSubview:crView.view];
[UIViewcommitAnimations];[UIViewbeginAnimations:@"back"context:nil];
[UIViewsetAnimationDuration:0.5];
[UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIViewsetAnimationTransition:UIViewAnimationTransitionCurlDownforView:self.view.superviewcache:YES];
[self.viewremoveFromSuperview];
[UIViewcommitAnimations];NSCalendar *calendar = [NSCalendar currentCalendar]; // 오늘달력을 얻는다.
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
NSDate *date = [NSDate date]; // 오늘 날짜를 얻는다.
NSDateComponents *comp = [calendar components:unitFlags fromDate:date];
NSLog(@"yeay:month:day = %d:%d:%d", [comp year], [comp month], [comp day]);
NSDateComponents *comps = [[NSDateComponentsalloc] init];
[comps setMonth:20];
[comps setYear:1000];
NSDate *newDate = [calendar dateByAddingComponents:comps toDate:date options:0];
comp = [calendar components:unitFlags fromDate:newDate];
NSLog(@"yeay:month:day = %d:%d:%d", [comp year], [comp month], [comp day]);
'개발도구 > iOS - 아이폰 개발' 카테고리의 다른 글
[아이폰] NSUserDefaults - 간단한 데이터 저장 화면전환 값 넘기기, 딜리게이트 값 넘기기 (0) | 2012.05.15 |
---|---|
[아이폰] storyboard turorial (0) | 2012.05.15 |
[아이폰] 그래프 graph 원그래프 chart 차트 (0) | 2012.05.10 |
[아이폰] how to use JSON in your app (0) | 2012.05.08 |
[아이폰] UIImage : 웹 그림 표시 (0) | 2012.05.08 |