小编Pet*_*erd的帖子

如何将UITableView放入UIView中

我试图将UITableView放入UIView.UIView也将包含其他一些东西,所以我想要定义UITiew的一部分以供UITableView使用.在这个和其他网站上阅读,我使用"UIViewController"并委托"".

我的问题是:

  • 为什么我看不到任何带有下面代码的UITable?

  • 当我更改InformatieSectieViewController.h时,为什么会看到UITable

    @interface InformatieSectieViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
    
    Run Code Online (Sandbox Code Playgroud)

    @interface InformatieSectieViewController : UIViewTableController <UITableViewDataSource, UITableViewDelegate>
    
    Run Code Online (Sandbox Code Playgroud)

    (UIViewController到UI Table ViewController)?(这个UITable然后占据了整个UIView).

  • 如何将UITableView正确地放入UIView中.

  • 什么也让我感到惊讶; 当我从@interface InformatieSectieViewController:UIViewController <UITableViewDataSource,UITableViewDelegate>中删除<UITableViewDataSource,UITableViewDelegate>部分时,我希望行上的警告(在InformatieSectieViewController.m中):

    tabView.delegate = self;
    tabView.dataSource = self;
    
    Run Code Online (Sandbox Code Playgroud)

    但我没有得到这个警告.

这是我正在使用的代码:

InformatieSectie.h

#import <UIKit/UIKit.h>
@interface InformatieSectie : NSObject
@property (strong, nonatomic) NSString *header;
-(UIView*)createInformatieSectie;
@end
Run Code Online (Sandbox Code Playgroud)

InformatieSectie.m

#import "InformatieSectie.h"
#import "InformatieSectieViewController.h"
#import <QuartzCore/QuartzCore.h>
@implementation InformatieSectie
@synthesize header;
@synthesize footer;
-(UIView*)createInformatieSectie{
    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 200, breedte, hoogte)];
    //(add headerlabel at pos)
    [view addSubview:headerLabel];

    InformatieSectieViewController *svc = …
Run Code Online (Sandbox Code Playgroud)

uitableview uiview ios

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

ios ×1

uitableview ×1

uiview ×1