반응형
rss 아이콘 이미지

Search

'stringByReplacingOccurrencesOfString'에 해당되는 글 1건

  1. 2011.06.01 [IB없이 개발하기] 아이폰 문자열 대체하기 stringByReplacingOccurrencesOfString
반응형
    UILabel *label;
    NSString *a;
    label = [[UILabel alloc] init];      
    label.frame = CGRectMake(0, 39, 150, 20);
    label.textAlignment = UITextAlignmentCenter;
    label.backgroundColor = [UIColor clearColor];
    label.font = [UIFont systemFontOfSize:20];
    label.textColor = [UIColor blackColor];
    a = @"들어갈 텍스트";
    label.text = a;
    [self.view addSubview:label];
    [label release];
   
    실행결과 : 들어갈 텍스트


    label.text = [a stringByReplacingOccurrencesOfString:@"들어" withString:@"없어지던가" ];

   실행결과 : 없어지던가갈 텍스트
 

   참 쉽죠잉 ~

반응형