मैं आईओएस की दुनिया में नया हूं और मैं जानना चाहता हूं कि UITableView
को कस्टम सेल के साथ कैसे बनाना है, जो आपके पास कुछ वाईफाई कनेक्शन कॉन्फ़िगर करने का प्रयास करते समय आपके जैसा दिखता है और व्यवहार करता है डिवाइस। (आप UITableView
को UITextField
एस वाले ब्लू फ़ॉन्ट के साथ UITableView
जानते हैं जहां आपने आईपी पता और सभी चीजें सेट की हैं ...)।प्रत्येक सेल पर एक टेक्स्टफील्ड के साथ संपादन योग्य UITableView
उत्तर
एक कस्टम सेल लेआउट बनाने के लिए कोडिंग का थोड़ा सा हिस्सा शामिल है, इसलिए मुझे उम्मीद है कि आपको डराना नहीं होगा।
पहली बात एक नया UITableViewCell
सबक्लास बना रही है। आइए इसे InLineEditTableViewCell
पर कॉल करें। आपका इंटरफेस InLineEditTableViewCell.h
कुछ इस तरह दिखाई दे सकता है:
#import <UIKit/UIKit.h>
@interface InLineEditTableViewCell : UITableViewCell
@property (nonatomic, retain) UILabel *titleLabel;
@property (nonatomic, retain) UITextField *propertyTextField;
@end
और अपने InLineEditTableViewCell.m
ऐसा दिखाई दे सकता:
#import "InLineEditTableViewCell.h"
@implementation InLineEditTableViewCell
@synthesize titleLabel=_titleLabel;
@synthesize propertyTextField=_propertyTextField;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Here you layout your self.titleLabel and self.propertyTextField as you want them, like they are in the WiFi settings.
}
return self;
}
- (void)dealloc
{
[_titleLabel release], _titleLabel = nil;
[_propertyTextField release], _propertyTextField = nil;
[super dealloc];
}
@end
अगला बात आप सेट-अप अपने UITableView
है आप सामान्य रूप से आपके विचार नियंत्रक में प्रदर्शित होंगे। ऐसा करने पर आपको UITablesViewDataSource
प्रोटोकॉल विधि - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
लागू करना होगा। इसके लिए अपना कार्यान्वयन डालने से पहले, अपने व्यू कंट्रोलर में #import "InLineEditTableViewCell"
को याद रखें। ऐसा करने के बाद कार्यान्वयन निम्नानुसार है:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
InLineEditTableViewCell *cell = (InLineEditTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"your-static-cell-identifier"];
if (!cell) {
cell = [[[InLineEditTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"your-static-cell-identifier"] autorelease];
}
// Setup your custom cell as your wish
cell.titleLabel.text = @"Your title text";
}
यही है! अब आपके पास UITableView
में कस्टम कक्ष हैं।
शुभकामनाएं!
- 1. UITableView प्रत्येक सेल
- 2. यथा-स्थान UITableView सेल के संपादन
- 3. संपादन योग्य UITableView, एक सेल में UITextField, किए जाने पर डेटा संग्रहीत किया जाता है
- 4. एक NSTableCellView संपादन योग्य
- 5. संपादन के दौरान UITableView didSelectRow?
- 6. UITableView सेल पर जाएं
- 7. UITableView - बाध्यकारी के माध्यम से बेहतर संपादन?
- 8. UITableView, संपादन मोड
- 9. UISwitch एक UITableView सेल
- 10. UITableView सेल
- 11. एक JTable सेल को संपादन योग्य बनाना - लेकिन * डबल
- 12. jqGrid एक संपादन योग्य चेकबॉक्स कॉलम
- 13. उपयोगकर्ता को UITableView सेल
- 14. uitableview संपादन मोड के दौरान segue को छोड़ दें
- 15. संपादन योग्य और गैर-संपादन योग्य
- 16. UITableView सेल इंडेक्सपाथ
- 17. संपादन योग्य
- 18. UITableView cell.contentView.bounds.size.width सेल रीयूज
- 19. UITableView सेल एनीमेशन जोड़ें
- 20. टेबल सेल पर एक क्लिक करने योग्य बटन कैसे जोड़ें?
- 21. एक कस्टम ऊंचाई पर UITableView स्थिर सेल कैसे सेट करें?
- 22. UITableView लोड सेल रिवर्स
- 23. UITableView के "प्रोटोटाइप सेल" विकल्प का क्या हुआ?
- 24. सामग्री के आधार पर गतिशील UITableView सेल ऊंचाई
- 25. UITableView संपादन मोड में है, जबकि UITableView संपादन मोड में है
- 26. UITableView सेल टेक्स्ट लेबल रंग
- 27. JCombobox संपादन योग्य सक्षम
- 28. UITableView में संपादन-स्थान कैसे करें?
- 29. सलाह, ExtJS 4 के साथ जरूरी सहायता: ग्रिड: सेल संपादन: ऑटो संपादन सुविधा
- 30. संपादन योग्य जेटीबल ट्यूटोरियल
आपकी मदद के लिए धन्यवाद। असल में मैं कोडिंग से डरता नहीं हूं, मैं ग्राफिक तत्वों में हेरफेर करने में अच्छा नहीं हूं :) – Zak001