標籤(UILabel)

(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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章