u16suzuの blog

日々学んだことのメモブログです。

Objective-C で Method定義

メソッド定義とその呼出し。
ここでは、viewCon.h and .mを編集する


hogeController.h

 (void)hello;
 (void)al: (NSString*)str;


hogeController.m

-(void)hello{
    printf("hello world\n");
}
 
 -(void)al:(NSString *)str{
    UIAlertView *a = [[UIAlertView alloc] initWithTitle:@"hoge" message:str  delegate:nil cancelButtonTitle:nil otherButtonTitles:@"ok", nil ];
   
    a.show;
}


呼び出し方(同じクラスのメソッド内で)

- (void)hello;
- (void)al: (NSString*)str;