添加一個彈出的UIView(定製類),我在這個新的,我希望得到一些建議,因爲我不知道我做錯了事情。 我想在Xcode中的應用,與一些項UIView
,當你做一些事情,另一個UIView
(小於第一)第一UIView
上方彈出。彈出UIView
將是一個定製的類。如何在一個UIViewController
我已經開始使用UIViewController
模板和初始UIView
,並且我已經鏈接了.storyboard
中的所有項目,並且它工作正常。但是,當我創建自己的UIView
(from objective-C class)
類,把第二UIView
在第一的storyboard
並將其鏈接到我的課,不順心的事。
的UIView
出現,但是當我嘗試將它設置爲隱藏,它沒有回答。這就像它沒有收到消息,所以我認爲我沒有以編程方式很好地鏈接,並且因爲storyboard
而出現。
我不知道如果我要創建另一個UIViewController中代替的UIView,或者如果這是正確的道路。
任何人都可以解釋我一點,或者只寫一點點代碼段與第二視圖的實例,並加入了嗎?
非常感謝!
#import <UIKit/UIKit.h>
#import "EditView.h"
@interface ReleaseViewController : UIViewController <UIWebViewDelegate, UISearchBarDelegate> {
IBOutlet UIWebView *web;
IBOutlet UISearchBar *search;
IBOutlet EditView *evHack;
}
@property (nonatomic, retain) IBOutlet UIWebView *web;
@property (nonatomic, retain) IBOutlet UISearchBar *search;
@property (nonatomic, retain) IBOutlet EditView *evHack;
@end
- (void)viewDidLoad
{
[super viewDidLoad];
search.delegate = self;
web.delegate = self;
evHack = [evHack initWithFrame:CGRectMake(0, 44, 320, 377)];
[evHack setHidden:YES];
}
EditView中類(我還是什麼都沒有)(我在.H和實例中的.m粘貼一些代碼,報關):
#import <UIKit/UIKit.h>
@interface EditView : UIView
@end
#import "EditView.h"
@implementation EditView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
NSLog(@"View created");
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end
這將有助於查看代碼,否則它可能是許多原因之一,爲什麼它不工作。 – gschandler
完成:) 我把它全部鏈接在故事板上。 –