English 中文(简体)
目 录
原标题:objective-C syntax beginner question

i want to use the appRecord.myName in the viewDidLoad,
when i put it there it error up that appRecord is undeclared, how to declare it?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *CellIdentifier = @"pilotWay";
    static NSString *PlaceholderCellIdentifier = @"PlaceholderCell";

    int nodeCount = [self.entries count];

    if (nodeCount == 0 && indexPath.row == 0)
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PlaceholderCellIdentifier];
        if (cell == nil)
        {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                           reuseIdentifier:PlaceholderCellIdentifier] autorelease];   
            cell.detailTextLabel.textAlignment = UITextAlignmentCenter;
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }

        cell.detailTextLabel.text = @"load";

        return cell;
    }

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                       reuseIdentifier:CellIdentifier] autorelease];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }

    if (nodeCount > 0)
    {
        AppRecord *appRecord = [self.entries objectAtIndex:indexPath.row];


        cell.textLabel.text = appRecord.myName;             
        cell.textLabel.text = appRecord.appName;
    }

    return cell;
}
问题回答

您是否在该档案的顶端有#import“AppRecord.h”?

看来,appcord is declaration (= do that)。 或许,你需要加入:(AppRecord *)[自发,entries ObjectAtIndex:indexPath.row]。 不管怎样,检查<代码>应用<> 现有:

NSLog(@"appRecord: %@", appRecord);

如有物体<代码>应用</code>,请在有记忆地址的情况下予以说明。 让我知道其中是否有任何帮助,或是否需要进一步解释。





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签