2013-06-13 2 views
0

Я попытался нагрузки массив из веб-службы и отображения на столе view.This мой tableview.But существует mistake.Branchnames являютсяГде моя ошибка в моем коде для отображения на табло?

МЕХМЕТ FUDAYLÖZCAN,

Селахаттин Koçak,

Мехмет Suner Eken Petrol

Hasan Katkıcı Бензин

и т.д.

и т.д.

но вид таблицы показывают мне нравится, что

Как это исправить?

enter image description here

Th табличные коды:

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes: (NSDictionary *)attributeDict 
{ 
    if ([elementName isEqualToString:@"Branchname"]) 
    { 
    teveRetorno = YES; 
    } 
    else if ([elementName isEqualToString:@"GetBranchNameResult"]) 
    { 
    myArray = [[NSMutableArray alloc] init]; 
    } 
} 

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ 
    if (teveRetorno) { 
    //[retornoSOAP appendString:string]; 
    [myArray addObject:string]; 
    } 
} 

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ 
    if ([elementName isEqualToString:@"Branchname"]) { 
    NSLog(@"My Array %@",myArray); 

    [[self tableView]reloadData]; 

    //retornoSOAP = nil; 
    teveRetorno = NO; 
    } 
} 

Таблица кодов

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    #warning Incomplete method implementation. 
    // Return the number of rows in the section. 

    return [self.myArray count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
    } 

    cell.textLabel.text =[myArray objectAtIndex:indexPath.row]; 
    return cell; 
} 
+1

В таком случае вы хотите знать, почему текст усечен? Попробуйте установить 'cell.textLabel.adjustsFontSizeToFitWidth = YES'. –

+0

@jeffamaphone Да, я хочу этого. И я хочу показывать в одной строке. Я добавил ваш код, и результат здесь. Http://picpaste.com/ekranson-6HXwMH0I.png – Mhmt

+0

Так решена ваша проблема? –

ответ

0

Если ваш спрашивать о причине текст становится отрезан, установленный adjustsFontSizeToFitWidth для TextLabel из клетка. Если этот дозатор исправить, затем вручную опустите шрифт textLabel.

Смежные вопросы