The Settings/Accessibility "Large Text" setting sets the text size in some built-in Apps.
How can I get hold of this setting to be used in my own App? I can create a private setting in my App of course, but I'd rather use the global setting.
I was expecting [UIFont systemFontSize] to adjust the size, but it always returns 14 regardless of the setting in Accessibility.
As far as I know this is not possible. I opened rdar://10660048 just in case, hopefully something similar will be available in iOS 6.x. If somebody knows private APIs to access the value I wouldn't mind knowing.
Related
My app uses UIStepper controls in a few different views. I released a minor update to the app that shouldn't affect these views at all, and I started getting reports that all the UISteppers in the app are now disabled. One user sent a screen shot, and the stepper control appears as if its enabled property were set to NO. However, there's no place in my code where I set this property at all, and the default is YES. I've searched my app for instances of the term "enabled" to make sure I'm not somehow disabling it accidentally, and I'm not.
I thought perhaps the default value for the enabled property changed between iOS versions, but the users who have reported this are running iOS 5.1.1, the same as my development devices. And I only started hearing about the problem with this app update.
Besides setting the enabled property, I found that the steppers will be disabled if the min and max values are set to the same value. I'm pretty sure this is not happening in my app. The values are hard-coded and passed to a setup method, and I haven't changed this code since many app versions ago.
Do you know any other reason why this would happen? I can't reproduce the problem myself, and it only affects some users, so it's difficult to troubleshoot.
Here's my code for creating the UISteppers, for what it's worth:
- (UIStepper *)makeStepperInput:(float )currentValue minValue:(float)minValue maxValue:(float)maxValue increment:(float)increment {
int stepperWidth = 94;
int stepperHeight = 27;
CGRect stepperFrame = CGRectMake(0, 0, stepperWidth, stepperHeight);
UIStepper *stepperInput = [[[UIStepper alloc] initWithFrame:stepperFrame] autorelease];
stepperInput.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
[stepperInput setValue:currentValue];
[stepperInput setMinimumValue:minValue];
[stepperInput setMaximumValue:maxValue];
[stepperInput setStepValue:stepValue];
[stepperInput setContinuous:NO];
NSLog(#"making stepper with values %f, %f, %f, %f (%i)", currentValue, minValue, maxValue, stepValue, stepperInput.enabled);
[stepperInput addTarget:self action:#selector(onChange:) forControlEvents:UIControlEventValueChanged];
return stepperInput;
}
UPDATE: I have a user who was willing to install a debug version with the NSLog line above. He sent me the console output and it shows that the min and max value of the stepper are correct (1 and 20 in one case) and that the enabled property is YES. Unfortunately, that eliminates both of my theories about what could be happening here...
Okay, here's what happened. The method posted above is a simplified version of my real method, which provides some branching for pre-iOS 5 devices. To help with pre-iOS 5 support, I was actually declaring stepperInput as a UIControl, and then returning something different on iOS versions that don't support UIStepper.
Now the interesting part. I rolled my project back and started looking at my build settings, and remembered that before my last release, Xcode gave me one of those alert messages about my build settings being out of date. I had clicked the button to allow Xcode to make all the recommended changes. This time, I performed one change at a time and tested my app after each change.
The first of the recommended changes was to "Upgrade Compiler configuration to LVVM". ("The compiler configuration is set to 'com.apple.compilers.llvmgcc42'. This will upgrade to 'Apple LLVM compiler 4.0', which is the recommended setting for iOS targets.") As soon as I made that change, the problem appeared on my test device. So it seems that the old compiler allowed me to set UIStepper properties on an object declared as a UIControl, while the new compiler did not. Indeed, when I changed my NSLog line above to output the actual values of the stepper, instead of the values passed into the method, they all returned 0. Having its min and max values both set to 0 is what made the stepper appear to be disabled.
I didn't think this affected all users because I couldn't reproduce it, but I was testing with the older build settings rather than the build settings used for the release. So now I'm thinking that this probably does affect all users, and only some users have noticed it.
Anyway, the solution is to reorganize my code so I can declare that UIStepper as a real UIStepper, since the newer compiler doesn't allow the kind of fudging I was doing before.
Is it possible to load a font from disk and use it during run-time?
If so, how/where do you store the fonts on the iphone/ipod/ipad for your app to use?
(To be clear, I'm not talking about adding the font as a resource at design-time. I'm asking about a way to allow a user to select a font file during run-time, loading it, and making it available for use.)
You should put them (.ttf, .otf) into your info-plist under UIAppFonts then you can "use" them with setFont: withSize:
You add your font as a resource, add it to your info.plist under Fonts provided by application (UIAppFonts) array, then use it as any embedded one.
Ok, in that case take a look at FontLabel project.
One thing though, looking through it's code - you can only get CGFontRef and with kind of voodoo work with it, no conversion between CGFontRef and UIFont really exists. See this question
I am building an app which I only want it to be in Swedish.
Based on many questions in SO I set the Localication native development region to Sweden.
I set this in the app-info.plist.
But this does not seem to work. The app and the systemButtons are always displayed in English.
SHould i do something else to make it work?
Is this value overridden somewhere else? (I am mainly concerned about UITableView delete to a translated version of 'delete' button)
Your help and suggestions will be greatly appreciated
You should use ableView:titleForDeleteConfirmationButtonForRowAtIndexPath: to force the name of the delete in the table view.
Good afternoon, sports!
I have a fast doubt.
I'm using COCOS2D and i need to know if i can use other extension type of font other than ".fnt".
Because i used a few and didn't have any luck.
I'm using this piece of code to make a "credits" scene:
CCBitmapFontAtlas* l_026 = [CCBitmapFontAtlas bitmapFontAtlasWithString:#"Look for our apps in the AppStore" fntFile:#"fission.fnt"];
If it isn't which can i use?
And it is do you know any font converter to change "normal fonts" to ".fnt"
Thanks!
The best font program in my opinion is: Glyph Designer. It is inexpensive and very easy to make great looking fonts.
I use CCLabelBMFont but I'm pretty sure it is basically the same thing.
If you have some cash to spend you can use Glyph Designer as suggested by Aaron. But you can also use a free Java tool named Hiero. You might have to do some tweaking to get the result you want though.
The tool will output 2 files: one .png and another .fnt. Add these files into your Xcode project and use it using simple lines like below:
CCLabelBMFont *some_label = [CCLabelBMFont labelWithString:#"Your Text" fntFile:#"fontfile.fnt"];
Do note though that the size of the font from each pair of fnt/png files is fixed, so you have to create multiple pairs if you want to have different font sizes. Also, you need separate pair for Retina and non-Retina display modes.
I need to access the iPhone's general accessibility settings; I need to know whether the user has turn on features such as "Speak Auto-text" or "White on Black" and respond to that programatically. I don't need to change the values, only read them. Also, if there's a way of defining (for my app) to ignore them (and set the corresponding support programatically) - that would be a good solution.
Any suggestions?
what about UIKit accessibility methods?
Accessibility
UIAccessibilityPostNotification
UIAccessibilityIsVoiceOverRunning
UIAccessibilityIsClosedCaptioningEnabled
UIAccessibilityIsGuidedAccessEnabled
UIAccessibilityIsInvertColorsEnabled
UIAccessibilityIsMonoAudioEnabled
UIAccessibilityZoomFocusChanged
UIAccessibilityRegisterGestureConflictWithZoom
You can't. I suspect this is by design.