1. 程式人生 > >IOS8之前 一些過期的方法的處理

IOS8之前 一些過期的方法的處理

1. drawInRect:  withFont:

//[placeholder drawInRect:CGRectMake(8.0f, 8.0f, self.frame.size.width - 16.0f, self.frame.size.height - 16.0f

//                                           

//                                           

//                                           )

//  withFont:self.font];

CGContextRef

context = UIGraphicsGetCurrentContext();

        CGContextSetRGBFillColor(context,0.7,0.7,0.7,1.0);              //設定填充顏色          //設定字型

        [placeholder drawInRect:CGRectMake(8.0f, 8.0f, self.frame.size.width - 16.0f, self.frame.size.height - 16.0f

                                           ) withAttributes

:@{NSFontAttributeName:self.font}];

2.

  NSError *audioError;

AVAudioSession *avSession = [AVAudioSessionsharedInstance];

    [avSession setCategory:AVAudioSessionCategoryPlayback error:&audioError];

    Float32 bufferLength = 0.1;

    [avSession setPreferredIOBufferDuration:bufferLength error

:&audioError];

    [avSession setActive:YES error:&audioError];