2014-09-28 1 views
-4

호환되지 않는 유형의 매개 변수에 'const를 CGRect를'전송 : 첫째는 initWithStyle : CGRectZero를 내가 코드의 덩어리 함께 일하고 있어요

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nil]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:CGRectZero reuseIdentifier:nil] autorelease]; 
} 
//cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

initWithStyle: 

initWithFrame: 

교체 위의

initWithFrame:reuseIdentifier deprecated 오류가 발생했기 때문입니다. 지금은 새로운 오류를 얻고있다

하지만, :

Sending 'const CGRect' (aka 'const struct CGRect') to parameter of incompatible type 'UITableViewCellStyle' (aka 'enum UITableViewCellStyle'). 

이 오류는 위의 initWithStyle:CGRectZero에서 CGRectZero에 특별히 가리키고 있습니다.

나는 이것을 조사했지만이 것을 알아 내지 못했습니다. 누구든지이 문제를 해결하는 방법을 알고 있습니까?
미리 감사드립니다. :)

+2

실제로 오류 메시지를 읽고 이해하려고 시도 했습니까? (그리고 UITableViewCell의 설명서를 보았습니까?) –

답변

0

style 인수가 UITableViewCellStyle enumeration values 중 하나 여야합니다 : 당신이 자세히 보면, 당신은 CGRectZero가 목록에없는 것을 발견 할 것입니다

typedef enum : NSInteger { 
    UITableViewCellStyleDefault , 
    UITableViewCellStyleValue1 , 
    UITableViewCellStyleValue2 , 
    UITableViewCellStyleSubtitle 
} UITableViewCellStyle; 

. 일반적으로 명령문을 변경하여 다른 메시지를 보내면 전달한 값을 메시지의 인수로 변경해야합니다.

관련 문제