[IOS 视图布局]--分享样式REComposeViewController
2013-04-17 20:47
337 查看
https://github.com/romaonthego/REComposeViewController
Apple LLVM compiler
iOS 5.0 or higher
ARC
in Xcode to see
action.
via
The recommended approach for installating REComposeViewController is via the CocoaPods package manager, as it provides flexible dependency
management and dead simple installation.
Install CocoaPods if not already available:
Edit your Podfile and add REComposeViewController:
Install into your Xcode project:
Simple
All you need to do is drop
into your project, and add
the top of classes that will use it.
Example
Set completion handler:
Alternatively, you may want to set your controller to conform to
to receive notifications when user cancels / posts.
You use the
the appearance proxy for a class. You customize the appearance of instances of a class by sending appearance modification messages to the class’s appearance proxy.
Example:
https://github.com/romaonthego
https://twitter.com/romaonthego
romefimov@gmail.com
Copyright © 2013 Roman Efimov.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
REComposeViewController
Replicates functionality of SLComposeViewController introduced in iOS 6.0. You can create composers for any social network out there. REComposeViewController doesn't provide logic for sharing, only its visual part.Requirements
Xcode 4.5 or higherApple LLVM compiler
iOS 5.0 or higher
ARC
Demo
Build and run theREComposeViewControllerExampleproject
in Xcode to see
REComposeViewControllerin
action.
Installation
via
CocoaPods
The recommended approach for installating REComposeViewController is via the CocoaPods package manager, as it provides flexible dependencymanagement and dead simple installation.
Install CocoaPods if not already available:
$ [sudo] gem install cocoapods $ pod setup
Edit your Podfile and add REComposeViewController:
$ edit Podfile platform :ios, '5.0' pod 'REComposeViewController', '~> 2.0.1'
Install into your Xcode project:
$ pod install
Simple
Install
All you need to do is drop REComposeViewControllerfiles
into your project, and add
#include "REComposeViewController.h"to
the top of classes that will use it.
Example
Usage
REComposeViewController *composeViewController = [[REComposeViewController alloc] init]; composeViewController.title = @"Social Network"; composeViewController.hasAttachment = YES; composeViewController.attachmentImage = [UIImage imageNamed:@"Flower.jpg"]; composeViewController.text = @"Hi there!"; [composeViewController presentFromRootViewController];
Set completion handler:
composeViewController.completionHandler = ^(REComposeViewController *composeViewController, REComposeResult result) { [composeViewController dismissViewControllerAnimated:YES completion:nil]; if (result == REComposeResultCancelled) { NSLog(@"Cancelled"); } if (result == REComposeResultPosted) { NSLog(@"Text = %@", composeViewController.text); } };
Alternatively, you may want to set your controller to conform to
REComposeViewControllerDelegateprotocol
to receive notifications when user cancels / posts.
... composeViewController.delegate = self; ...
- (void)composeViewController:(REComposeViewController *)composeViewController didFinishWithResult:(REComposeResult)result { [composeViewController dismissViewControllerAnimated:YES completion:nil]; if (result == REComposeResultCancelled) { NSLog(@"Cancelled"); } if (result == REComposeResultPosted) { NSLog(@"Text = %@", composeViewController.text); } }
Customization
REComposeViewController navigation bar can be customized via UIAppearance.You use the
UIAppearanceprotocol to get
the appearance proxy for a class. You customize the appearance of instances of a class by sending appearance modification messages to the class’s appearance proxy.
Example:
[composeViewController.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg"] forBarMetrics:UIBarMetricsDefault]; composeViewController.navigationItem.leftBarButtonItem.tintColor = [UIColor colorWithRed:60/255.0 green:165/255.0 blue:194/255.0 alpha:1]; composeViewController.navigationItem.rightBarButtonItem.tintColor = [UIColor colorWithRed:29/255.0 green:118/255.0 blue:143/255.0 alpha:1];
Credits
Partially based on DEFacebookComposeViewController and DETweetComposeViewController.Contact
Roman Efimovhttps://github.com/romaonthego
https://twitter.com/romaonthego
romefimov@gmail.com
License
REComposeViewController is available under the MIT license.Copyright © 2013 Roman Efimov.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
相关文章推荐
- [IOS 视图布局]左右菜单PPRevealSideviewController
- 自学iOS开发系列----UI(视图编程入门:ViewController、UIImageView、UILabel)
- IOS Note - View Controller(视图控制器)
- iOS开发 剖析网易新闻标签栏视图切换(addChildViewController属性介绍)
- 因IOS版本导致的模态视图控制器dismissModalViewControllerAnimated调用问题
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程4
- iOS属性传值(视图控制器viewController的执行顺序的理解和懒人加载的理解)
- iOS开发中活动视图控制器UIActivityViewController的应用
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程4
- ios关于自带分享UIActivityViewController
- 【IOS】利用UIActivityViewController实现分享视频,图片,链接
- ios 开发日记 13-剖析网易新闻标签栏视图切换(addChildViewController属性介绍)
- ios UICollectionViewController集合视图(四)
- iOS 6分享列表——UIActivityViewController详解
- [ IOS ] 视图控制对象ViewController的生命周期
- iOS 两种系统分享(配Demo下载)UIActivityViewController 和 SLComposeViewController
- iOS- 用UICollectionViewController 来进行横竖屏九宫格布局
- ios UICollectionViewController集合视图(一)
- iOS View Controller 全屏布局
- iOS 原生UIActivityViewController(分享功能)