ios7

Use AVSpeechSynthesizer on iOS 7 but retain compatibility for iOS 6

我的梦境 提交于 2020-01-02 06:42:01
问题 Hello I Understand TTS is only available in iOS 7 but i used many apis in the past by checking if the class is available and managed to retain compatibility on previous versions but with AVSpeechSynthesizer it doesn't seem to work, can you please help me use TTS for iOS 7 and retain compatibility by disabling it in iOS 6, thank you very much. Here is my code but it doesn't seem to work if (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)) { if([AVSpeechSynthesizer class]) {

Use AVSpeechSynthesizer on iOS 7 but retain compatibility for iOS 6

蓝咒 提交于 2020-01-02 06:41:09
问题 Hello I Understand TTS is only available in iOS 7 but i used many apis in the past by checking if the class is available and managed to retain compatibility on previous versions but with AVSpeechSynthesizer it doesn't seem to work, can you please help me use TTS for iOS 7 and retain compatibility by disabling it in iOS 6, thank you very much. Here is my code but it doesn't seem to work if (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)) { if([AVSpeechSynthesizer class]) {

UITextView number of lines iOS 7

随声附和 提交于 2020-01-02 03:15:11
问题 In iOS 6 I used this code to get the number of lines in the UITextView : int numLines = textView.contentSize.height / textView.font.lineHeight; But this is not working in iOS 7. How do I get the total number of lines of the UITextView in iOS 7? 回答1: You can use something like this. It's low performance but this is what I could figure till now. NSString *string=textView3.text; NSArray *array=[string componentsSeparatedByString:@"\n"]; NSLog(@"%d",array.count); 回答2: You can do this with the

UIWindow frame in ios 8 different from ios 7 in Landscape

此生再无相见时 提交于 2020-01-02 02:18:28
问题 I've create simple module where I add subview to UIWindow. In simulator ios 7(Xcode 5.1.1) I have printed self.windows and I get: <UIWindow: 0x8db1670; frame = (0 0; 768 1024); autoresize = W+H; gestureRecognizers = <NSArray: 0x8db1a70>; layer = <UIWindowLayer: 0x8db17d0>> but on ios8 (Xcode 6 beta 6) I get: <UIWindow: 0x794320d0; frame = (0 0; 1024 768); gestureRecognizers = <NSArray: 0x79437a80>; layer = <UIWindowLayer: 0x7943c400>> The question is: why there is a difference in frame

In ios7, UITableViewCellAccessoryDetailDisclosureButton is divided into two different accessory buttons

冷暖自知 提交于 2020-01-02 01:45:08
问题 Check mark represents the selected row at that time, left image is of iOS7 simulator and right is of iOS6 simulator. The concern is UITableViewCellAccessoryDetailDisclosureButton in iOS7 has two parts, one part with right arrow accessory and other is the clickable "i" button rather than iOS6. Is it a standard behaviour or am I doing something wrong, if it is standard then what should be the correct way of handling UITableViewCellAccessoryDetailDisclosureButton in iOS7? 回答1: mahboudz is

iOS7 crashing - [__NSPlaceholderDictionary initWithObjects

ε祈祈猫儿з 提交于 2020-01-02 00:58:12
问题 Going through my iOS6 app and trying to fix everything for iOS7. Throughout my app I'm getting the error: -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0] Here is the stack trace from this code: NSString *shareString = [NSString stringWithFormat:@"I ... %@", self.booking.venue.name]; NSArray *activityItems = [NSArray arrayWithObjects:shareString, nil]; UIActivityViewController *activityViewController = [[UIActivityViewController alloc]

How to detect mobile safari browser in ios 7?

流过昼夜 提交于 2020-01-02 00:54:12
问题 What is the official method to detect mobile safari on ios7? For example: navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/) && navigator.userAgent.match(/OS 7/) 回答1: Try this (to detect iPod touch as well): navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 7_\d/i) 回答2: Try this navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 7_\d/i) 回答3: /iP(ad|hone|od)/.test(navigator.userAgent) Gives simple T/F. 来源: https://stackoverflow.com/questions

iOS 7: How to set UIBarButtonItem backButtonBackgroundImage for UIControlStateHighlighted?

☆樱花仙子☆ 提交于 2020-01-02 00:53:08
问题 I am trying to set the background image for back button in normal and highlighted states. - (void)configureBackButtonInNavigationItem:(UINavigationItem *)item { UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"back" style:UIBarButtonItemStyleBordered target:nil action:NULL]; [backBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]} forState:UIControlStateNormal]; [backBarButtonItem setTitleTextAttributes:@

Chrono Timer Not Converting Seconds Properly

会有一股神秘感。 提交于 2020-01-02 00:10:20
问题 I am having an interesting, yet strange issue with my game timer. It seems like the milliseconds works just fine. However, when I try to apply the std::chrono::seconds cast I suddenly get 0.000000 when casting to a float. My timer is as follows: #include <iostream> #include <time.h> #include <chrono> class Timer { public: typedef std::chrono::high_resolution_clock Time; typedef std::chrono::milliseconds ms; //<--If changed to seconds, I get 0.00000 typedef std::chrono::duration<float> fsec;

How to make UITableView row height respond to user's preferred text size (Dynamic Type)?

冷暖自知 提交于 2020-01-01 19:42:10
问题 I would like the UITableView 's row height to respond to changes in the user's preferred text size. For example, when the preferred text size increases, I would like to increase the row height by a proportional amount. Here's what I have so far: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.tableView reloadData]; // observe when user changes preferred text size [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector