2014-05-17 2 views
-1

UITableView 컨트롤러에서 푸시 된 DetailView 컨트롤러가 있습니다. 내가 뭘 하려는지 UITableViewController에서 푸시 될 때 제목의 글꼴을 변경하는 것입니다. 나는 내가하고있는 나의 segue를위한 코드 라인을 보여줄 것이다.DetailView 컨트롤러 제목 글꼴 문제

FourthTableViewController.m:134:34: Incompatible pointer types assigning to 'NSString *' from 
'UIFont * 

제목이나이 주위에 방법을 구문 분석 할 수있는 방법이 있나요 :

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
//push segue identifier 'showArrayDetail' 
if ([[segue identifier] isEqualToString:@"ShowDetail"]) 
{ 
    NSString *object = nil; 

    [[segue destinationViewController] setDetailLabelContents:object]; 

    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; 
    DetailViewController *destViewController = segue.destinationViewController; 
    destViewController.climbName = climbs[indexPath.row]; 
    destViewController.title = [NSString stringWithFormat:@"%@ Details", destViewController.climbName]; 

    destViewController.title = [UIFont fontWithName:@"Chalkduster" size:17]; 
} 

} 

이 매우 마지막 줄은 내가 글꼴을 변경하려고하는 경우, 그것은 나에게이 경고를주고있다인가? 내 UITableViews 등 내 글꼴을 변경할 때 나는이 같은 방법으로 일하고있다. 그것은 당신이 제목을 할 때 그냥 좋아하지 않는다.

감사합니다.

+0

속성 제목은 무엇입니까? UILabel 또는 NSString? –

+0

NSSString – javaGeek

+1

글꼴을 NSString, NSAttributedString 또는 글꼴 속성이있는 글꼴로 설정할 수 없습니다. 원인이있는 문자열이 포함 된 아래의 답변이 –

답변

0

실제로 글꼴을 변경할 수 없습니다. 방금 NSString 인스턴스가 아닌 UIFont의 새 인스턴스를 만들었습니다. 귀속 된 문자열에 대해 더 읽어야합니다. here. 예 :

NSFont *font = [NSFont fontWithName:@"Palatino-Roman" size:14.0]; 
NSDictionary *attrsDictionary = 
     [NSDictionary dictionaryWithObject:font 
            forKey:NSFontAttributeName]; 
NSAttributedString *attrString = 
    [[NSAttributedString alloc] initWithString:@"strigil" 
      attributes:attrsDictionary];