-4
變成真的,我想使標籤具有文本,當標籤變成文字,我想, 我想播放的聲音只播放聲音時條件的iOS
我的意思是一個時間我有一個按鈕,點擊時它檢查標籤文本,如果標籤文本是我想要它播放聲音的一個(聲音時間不超過2秒)
這是接口部分(viewController。 h)
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
UILabel *label;
}
@property (nonatomic , strong) IBOutlet UILabel *label;
-(IBAction) checkLabelText:(UIButton *)sender;
@end
this the implementation section (viewController.m)
#import "viewController.h"
@implementation ViewController
@synthesize label
-(IBAction) checkLabelText:(UIButton *)sender
{
if([label.text isEqualToString:@"hi world"])
{
//i want the code of playing the sound here
}
}
@end
Whats your bug? –
你想要的代碼? –
請提供更多詳情。 –