![](/img/trans.png)
[英]Cordova 4.4.0 call iOS Objective-C native method not working
[英]IOS/Objective-C: call of another class(VC) method not working
我已經搜索了這個問題的答案,發現我發現的解決方案似乎不起作用,所以我想我做錯了什么:我想調用此方法
-(void)customFade:(UILabel *)theLabel withDelay:(float)delayAmount {
[UIView animateWithDuration:0.5
delay:delayAmount
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
[theLabel setAlpha:1.0f];
[theLabel setAlpha:0];
}completion:nil];
}
從一個名為View Controller的VC到另一個VC,但是盡管導入也無法識別...這是我在所需VC上嘗試的方法:
- (void)viewDidLoad {
[super viewDidLoad];
ViewController *ViewController = [[ViewController alloc] init];
[ViewController customFade:_label withDelay:0.3];
}
警告說“ ViewController沒有可見的@interface”聲明選擇器alloc
有人可以幫我嗎? 我有點新,謝謝
當您輸入錯誤的方法名稱,或者該方法根本不屬於該類並且在您的類中不存在時,通常會發生這種錯誤。
並確保您的VC是UIViewController的子類
@interface ViewController:UIViewController
更改您的實例對象類型並檢查一次
ViewController *vc = [[ViewController alloc] init];
[vc customFade:_label withDelay:0.3];
並像這樣改變動畫
[UIView animateWithDuration:0.5
delay:delayAmount
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
[theLabel setAlpha:1.0f];
}completion:{
[theLabel setAlpha:0];
}];
有關更多信息,您可以從此處獲取參考
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.