2014-10-30 2 views
-1

콘솔 창에 메시지가 표시되지만 프로그램을 실행할 때 uitextview에 표시되지 않습니다.메시지가 iOS의 UITextView에 표시되지 않습니까?

-(void)getSmsData 
{ 
    array = [[NSMutableArray alloc] init]; 

    NSArray *docPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
                  NSUserDomainMask, YES); 
    NSString *documentDir = [docPaths objectAtIndex:0]; 
    self.databasePath = [documentDir stringByAppendingPathComponent:@"SMS.sqlite"]; 

    FMDatabase *database = [FMDatabase databaseWithPath:self.databasePath]; 
    [database setLogsErrors:TRUE]; 
    [database open]; 

    NSString *anQuery = [[NSString alloc]initWithFormat:@"SELECT * FROM SMSnJokes where 
    Id=%@",self.Id ]; 

    FMResultSet *results = [database executeQuery:anQuery]; 

    while([results next]) 
    { 
     SmsTitle *title=[[SmsTitle alloc]init]; 
     title.Id = [results stringForColumn:@"Id"]; 
     title.Data=[results stringForColumn:@"Data"]; 
     title.CategoryId = [results stringForColumn:@"CategoryId"]; 
     title.Title = [results stringForColumn:@"Title"]; 
     [array addObject:title]; 
     NSLog(@"SMS LIST %@",title.Data); 
    } 


    [database close]; 
} 

-(void)getSmsdisplay 
{ 
    smsdisplay=[[UITextView alloc]init]; 

    for (SmsTitle *title in array) 
    { 
     NSString *tempStr = title.Data; 
     smsdisplay.text=tempStr; 
     smsdisplay.editable = NO; 
     [smsdisplay setTextColor:[UIColor blackColor]]; 
     smsdisplay.font = [UIFont systemFontOfSize:15];   
    } 

    [self.view addSubview:smsdisplay]; 
} 

콘솔 창에 메시지가 표시되지만 프로그램을 실행할 때 uitextview에 표시되지 않습니다.

+0

UITextView의 텍스트를 설정하지 마십시오 ... –

+0

smsdisplay는 어디에서 만들었습니까? 나는 UITextView * smsdisplay를 볼 수 없었다. 네가 이것을 XIB에서 만들었다면. 또는 스토리 보드 그럼 smsdisplay = [[UITextView alloc] init];을하지 않아도됩니다. 또한 텍스트 뷰의 프레임을 설정해야합니다. –

답변

3

: NSLog(@"SMS LIST %@",title.Data);

+0

고마워하지만이 문제는 이미 내 다른 질문을 참조하십시오 http://stackoverflow.com/questions/26649974/my-screen-not-move-next-screen-on-buttons -click-in-ios? noredirect = 1 # comment41903952_26649974 –

1

텍스트 뷰의 프레임을 설정하지 않았습니다. 당신은 UITextView 프레임을 설정해야

_myTextfield.text = [NSString stringWithFormat:@"%@\n%@", _myTextfield.text, title.data]; 
2

은 텍스트 필드를 업데이트하려면 다음 코드를 추가합니다. XIB에서 TextView를 만드는 경우 alloc-init 메서드를 호출하지 마십시오.

UITextView *smsdisplay = [[UITextView alloc] initWithFrame: YOUR_FRAME]; 
// some stuff... 
[self.view addSubview: smsdiplay]; 
+0

감사의 작품 –

+0

당신은 환영합니다 :) –

관련 문제