그룹화 된 단면 뷰를 작성하려고합니다. 사전에 객체를 배열로 설정하려고하지만 빈 배열 문제를 발견했습니다. 이게 가능합니까 ????? There is a trick ???NSString을 사용하여 NSArray를 구현할 수 있습니까?
#import "RootViewController.h"
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
// Get the specific Node for this row.
Nodes *nodes = (Nodes *)[nodesMArray objectAtIndex:indexPath.row];
// Create the Details View Controller and initialize it.
nodesDetailView *viewController = [[nodesDetailView alloc] initWithStyle:UITableViewStyleGrouped ];
[[self navigationController] pushViewController:viewController animated:YES];
// Set the title of the view to the nodes name
viewController.title = [nodes computer_name];
//Information
//Network Data
viewController.ipaddress= [nodes ipaddress];
viewController.subnet_mask= [nodes subnet_mask];
viewController.gateway= [nodes gateway];
viewController.domain_name= [nodes domain_name];
}
#import "nodesDetailViewController. h
@interface nodesDetailView : UITableViewController{
//Network Data
NSString *ipaddress;
NSString *subnet_mask;
NSString *gateway;
NSString *domain_name;
//Grouped
NSMutableArray *Keys;
NSMutableDictionary *Contents;
}
@property (nonatomic, retain) NSMutableArray *Keys;
@property (nonatomic, retain) NSMutableDictionary *Contents;
@property (nonatomic, retain) NSString *ipaddress;
@property (nonatomic, retain) NSString *subnet_mask;
@property (nonatomic, retain) NSString *gateway;
@property (nonatomic, retain) NSString *domain_name;
@end
#import "nodesDetailViewController. m
@synthesize .......
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
NSMutableArray *keys = [[NSMutableArray alloc] init];
NSMutableDictionary *contents = [[NSMutableDictionary alloc] init];
NSString *network = @"Network Data";
NSString *product = @"Product Details";
//IS THIS POSSIBLE ??????? Because I get An Empty array
[contents setObject:[NSArray arrayWithObjects: ipaddress,subnet_mask, gateway, domain_name, nil] forKey:network];
return self;
}
감사합니다.
어떻게 비어 있다는 것을 알고 계십니까? –
귀하의 질문을 명확하게하십시오 ... –
NSlog it and arry 내용은 { "일반 정보"= ( )입니다. "네트워크 데이터"= ( ); "제품 세부 정보"= ( ); } – ngeran