(1) Effect of the printer
The first step: adding the file you needed(typewriter.wav , ZTypewriteEffectLabel.h ,ZTypewriteEffectLabel.m)
The second step : ZTypewriterEffectLabel *mylabel=[ZTypewriterEffectLabel alloc]initWithFrame:CGRectMake(5,30,310,450)] ;
mylabel.tag=10 ;
mylabel.backgroundColor=[UIColor clearColor] ;
mylabel.numberOfLines=0 ;
mylabel.text=@"Hello, Mr Hu" ;
mylabel.textColor=self.view.backgroundColor ;
mylabel.typewriteEffectColor=[UIColor greenColor];
mylabel.hasSound=YES;
mylabel.typewriteTimeInterval=0.3 ;
mylabel.typewriteEffectBlock=^{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"prompt" message:@“print complete” delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
};
[self.view addSubview:mylabel];
[self performSelector:@selector(startOutPut) withObject:nil afterDelay:1];
-(void)startOutPut{
ZTypewriterEffectLabel *myLabel=(ZTypewriteEffectLabel *)[self.view viewWithTag:10];
[myLabel startTypewrite];
}
T