【发布时间】:2013-11-26 18:50:14
【问题描述】:
我试图将一个变量从我的主 UIViewController 传递到 UIView。
CGRect frame = CGRectMake(0,0,347, 308);
XBMCPopUpView * xbmcpop = [[XBMCPopUpView alloc]initWithFrame:frame];
xbmcpop.DevIP = @"2222";
[self.view addSubview:xbmcpop];
对象 xbmcpop 被创建,其字符串属性“DevIP”被正确分配。但是当实际查看 UIVIEW 时,似乎查看的实例与我创建的实例不同,并且变量 @"2222" 未传递给字符串属性 "DevIP"
注意:我的主 UIViewController 位于带有导航控制器的情节提要中
如果你有兴趣看“XBMCPopUpView 类,这里是:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class XBMCPopUpView;
@interface XBMCPopUpView : UIView
{
NSString * DevIP;
}
@property (strong,nonatomic) NSString *DevIP;
- (id)initWithFrame:(CGRect)frame;
-(IBAction)sendPlay:(id)sender;
@end
【问题讨论】:
标签: ios objective-c uiview uiviewcontroller