일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 델파이
- Visual Studio 2005
- SDK
- Visual Basic
- Firebird
- VB.NET
- WIN32 SDK
- xml
- 파라미터
- winsock
- 셋업
- 인스톨
- c#
- 파이어버드
- 문자열
- dll
- vb
- 데이터베이스
- 기초
- 소니
- MySQL
- 초보
- PostgreSQL
- 입문
- 예제
- 설치
- MFC
- 시리얼 통신
- Delphi
- SQL
- 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