我正在尝试将一个变量从我的主 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 位于带有导航 Controller 的 Storyboard 中
如果您有兴趣查看“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
最佳答案
在下面
@interface XBMCPopUpView : UIView
消除
{
NSString * DevIP;
}
关于ios - 变量未传递给 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20225466/