Swift developed the text content to voice, only to convert the online OC version to the SWIFT version, the need for students to take.
Xcode7
The code is as follows |
Copy Code |
swift2.0 Import Uikit Import Avfoundation Class Viewcontroller:uiviewcontroller { Override Func Viewdidload () { Super.viewdidload ()
Let audiosession = Avaudiosession.sharedinstance () do { Try Audiosession.setcategory (Avaudiosessioncategoryplayback) }catch let error as nserror{ Print (Error.code) }
Let av = avspeechsynthesizer.init () Let Utterance1 = Avspeechutterance.init (string: "Hefei Forum is opened by Hefei Hotline website The portal community is also the first living community in Anhui Province. Hefei Hotline by the Hefei Fertilizer Network Technology Co., Ltd. was founded in 2003, Anhui is the first city portal. After 10 years of operation, Hefei Forum has become the largest forum in the province, the number of users, The best word of mouth, community services, the most comprehensive community. The forum has nearly 2.3 million of the official registered members, a daily view of more than 4 million times , with more than 70000 people online. 2006, Hefei Forum has become one of China's hundred strong network community. ") Utterance1.postutterancedelay = 0.5 Utterance1.rate = 0.1 Av.speakutterance (Utterance1)
Do no additional setup after loading the view, typically from a nib. } override func didreceivememorywarning () { Super.didreceivememorywarning () //Dispose of any of the CAN Recreated. } } |