일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- Delphi
- 기초
- 입문
- 소니
- SDK
- 데이터베이스
- Firebird
- xml
- SQL
- MFC
- 초보
- vb
- WIN32 SDK
- 파이어버드
- 파라미터
- 시리얼 통신
- 예제
- 델파이
- 설치
- c#
- PostgreSQL
- Visual Basic
- winsock
- dll
- MySQL
- 셋업
- 문자열
- 인스톨
- VB.NET
- Visual Studio 2005
- Today
- Total
프로그래밍 노트
[Xcode]구구단 2단 출력하기 본문
Xcode에서 프로젝트 만들어서 간단한 프로그램을 만드는 것은 패스
구구단 2단 출력하는 소스스
ViewController.m 화일에 소스를 입력한다.
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// 사용할 라벨 배열 정의
UILabel *lb[9];
for(int i=1; i < 10; i++){
// 라벨 초기화
lb[i] = [[UILabel alloc] init];
// 라벨 위치 설정(라벨 x좌표, 라벨 y좌표, 라벨 폭, 라벨 높이)
lb[i].frame = CGRectMake(10, i * 20, 400, 20);
// 라벨 문자열 설정
lb[i].text = [NSString stringWithFormat:
@" 2 * %d = %d", i, 2 * i];
[self.view addSubview:lb[i]];
self.view.backgroundColor = [UIColor whiteColor];
}
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end