0

我有带有三个部分的分组样式的表格视图。从字典数组中获取信息。

我的应用程序适用于 UITable (Master) 和一个 UIView (root)。但是,我想继续将信息从选择的 Cell 推送到直接连接到 UIView(根)的第三个 UIView。

-UIView(根)有:

.h    
@property (strong, nonatomic) id detailItem;



.m
#import "DetailViewController.h"

@interface DetailViewController ()
- (void)configureView;
@end

@implementation DetailViewController

@synthesize detailItem = _detailItem;
@synthesize courseDetailLabel = _courseDetailLabel;


#pragma mark - Managing the detail item

- (void)setDetailItem:(id)newDetailItem
{
    if (_detailItem != newDetailItem) {
        _detailItem = newDetailItem;

        // Update the view.
        [self configureView];
    }
}

- (void)configureView
{
    // Update the user interface for the detail item.

    if (self.detailItem) {

        self.courseDetailLabel.text = [[self.detailItem valueForKey:@"courseDetails"] description];
    }
}
4

1 回答 1

1

您应该重新考虑您的设计 - 如果在整个应用程序的许多屏幕上需要填充您的视图/表格/单元格/等所需的数据,您应该创建一个管理这些数据的单例类,并且可以从任何需要它的视图控制器访问。这样,您需要在视图之间“推送”的只是将控制器指向所需数据的索引。

于 2012-06-22T11:52:27.220 回答