2013-06-02 10 views
5

के कस्टम सबक्लास पंजीकृत करने में विफल होने के कारण मेरे पास UITableViewCell के दो कस्टम उप-वर्ग हैं जो Xcode पसंद नहीं करते हैं। इसलिए जैसे विधि: forReuseIdentifier: मैं registerClass कॉल करने के लिए कोशिश कर रहा हूँUITableViewCell

static NSString* gameCellIdentifier = @"GameCell"; 
static NSString* buttonCellIdentifier = @"ButtonCell"; 
// Register the classes for use. 
[self.tableView registerClass:ButtonCell forCellReuseIdentifier:buttonCellIdentifier]; 
[self.tableView registerClass:GameCell forCellReuseIdentifier:gameCellIdentifier]; 

और मैं त्रुटि, हो रही है "अप्रत्याशित इंटरफ़ेस नाम ... उम्मीद अभिव्यक्ति के बजाय।" त्रुटि। कोई विचार?

उत्तर

8

आप एक ClassregisterClass:forCellReuseIdentifier: को भेजने की जरूरत है ताकि आप ऐसा करने की जरूरत:

[self.tableView registerClass:[ButtonCell class] forCellReuseIdentifier:buttonCellIdentifier]; 
[self.tableView registerClass:[GameCell class] forCellReuseIdentifier:gameCellIdentifier]; 

गुड लक!

1

कोई बात नहीं, मैंने इसे समझ लिया। मुझे इसके बजाय [बटनसेल क्लास] करने की ज़रूरत है।

+0

यही वह है! मैंने यह तब तक नहीं देखा जब तक कि मैंने अपना जवाब पोस्ट नहीं किया ... – Daniel