Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chrismiles/CMTextStylePicker
iOS view controller tree for presenting a text font/size/colour picker to user.
https://github.com/chrismiles/CMTextStylePicker
Last synced: 2 months ago
JSON representation
iOS view controller tree for presenting a text font/size/colour picker to user.
- Host: GitHub
- URL: https://github.com/chrismiles/CMTextStylePicker
- Owner: chrismiles
- License: mit
- Created: 2010-11-20T04:37:49.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2010-11-20T07:23:27.000Z (about 14 years ago)
- Last Synced: 2023-03-11T12:02:15.713Z (almost 2 years ago)
- Language: Objective-C
- Homepage:
- Size: 484 KB
- Stars: 99
- Watchers: 9
- Forks: 23
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- awesome - CMTextStylePicker - iOS view controller tree for presenting a text font/size/colour picker to user. (etc)
- awesome - CMTextStylePicker - iOS view controller tree for presenting a text font/size/colour picker to user. (etc)
README
CMTextStylePicker
=================iOS view controller tree for presenting a text font/size/colour picker to user.
It is also possible to use the font or colour selectors separately.
A universal (iPhone/iPad) demo app is included with the source.
Screenshots
-----------|ipad_demo| |iphone_demo|
.. |ipad_demo| image:: http://farm5.static.flickr.com/4128/5191609858_76368e3041.jpg
.. |iphone_demo| image:: http://farm5.static.flickr.com/4089/5191609788_5f38a0393c.jpgUsage
-----CMTextStylePickerViewController is the main class. It is designed to
be added to a UINavigationController, either at the root or pushed
on to the navigation tree. The UINavigationController would typically
be presented as a modal view controller on the iPhone or within a
UIPopoverController on the iPad.Example::
CMTextStylePickerViewController *textStylePickerViewController = [CMTextStylePickerViewController textStylePickerViewController];
textStylePickerViewController.delegate = self;
textStylePickerViewController.selectedTextColour = aTextView.textColor;
textStylePickerViewController.selectedFont = aTextView.font;
if ([aTextView.textColor isEqual:defaultTextColor] && [aTextView.font isEqual:defaultFont]) {
textStylePickerViewController.defaultSettingsSwitchValue = YES;
}
else {
textStylePickerViewController.defaultSettingsSwitchValue = NO;
}
UINavigationController *actionsNavigationController = [[[UINavigationController alloc] initWithRootViewController:textStylePickerViewController] autorelease];The delegate should implement the CMTextStylePickerViewControllerDelegate protocol.
CMTextStylePickerViewControllerDelegate callback examples::
- (void)textStylePickerViewController:(CMTextStylePickerViewController *)textStylePickerViewController userSelectedFont:(UIFont *)font {
aTextView.font = font;
}
- (void)textStylePickerViewController:(CMTextStylePickerViewController *)textStylePickerViewController userSelectedTextColor:(UIColor *)textColor {
aTextView.textColor = textColor;
}- (void)textStylePickerViewControllerSelectedCustomStyle:(CMTextStylePickerViewController *)textStylePickerViewController {
// Use custom text style
aTextView.font = textStylePickerViewController.selectedFont;
aTextView.textColor = textStylePickerViewController.selectedTextColour;
}- (void)textStylePickerViewControllerSelectedDefaultStyle:(CMTextStylePickerViewController *)textStylePickerViewController {
// Use default text style
aTextView.font = self.defaultFont;
aTextView.textColor = self.defaultTextColor;
}- (void)textStylePickerViewController:(CMTextStylePickerViewController *)textStylePickerViewController replaceDefaultStyleWithFont:(UIFont *)font textColor:(UIColor *)textColor {
self.defaultFont = font;
self.defaultTextColor = textColor;
}- (void)textStylePickerViewControllerIsDone:(CMTextStylePickerViewController *)textStylePickerViewController {
[self dismissModalViewControllerAnimated:YES];
}See the demo application, CMTextStylePickerDemo, for more examples of use.
CMTextStylePickerDemo is a universal app and demonstrates the use of
CMTextStylePicker on both iPhone and iPad user interfaces.License
-------CMTextStylePicker is released under the MIT license. See LICENSE for details.
CMTextStylePicker is copyright (c) Chris Miles 2010.