पर एकाधिक UITableViews मुझे एक UIView पर दो UITableViews की आवश्यकता है। मैं इसे एक के साथ काम कर सकता हूं, यहां कोड है:एक UIView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [contentOne count]; // sets row count to number of items in array
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
NSString *firstValue = [[NSString alloc] initWithFormat: @"Row %i% %", indexPath.row+1 ];
NSString *secondValue = [contentOne objectAtIndex:indexPath.row];
NSString *cellValue = [firstValue stringByAppendingString: secondValue]; // appends two strings
[cell.textLabel setText:cellValue];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
मैंने कई अलग-अलग तरीकों की कोशिश की है। किसी को? अगर मैं प्रत्येक UITableView को एक अलग नाम नाम दे सकता हूं जो इसे करना चाहिए, लेकिन यह मुझे बिना किसी क्रैश किए किसी भी चीज़ पर तालिका को देखने की अनुमति देगा।
डुप्लिकेट प्रश्न समाधान में दिए गए प्रयास करें: http://stackoverflow.com/a/11789681/846372 – Soniya