This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:platformName]; | |
snsPlatform.loginClickHandler(self, | |
[UMSocialControllerService defaultControllerService], | |
YES, | |
^(UMSocialResponseEntity *response){ | |
//code | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 需要加入BubbleWrap和Sugarcube 的Gem | |
def shoot | |
UIActionSheet.alert('', buttons: [nil, nil, '马上拍一张', '从手机相册选择', '返回']) do |pressed| | |
case pressed | |
when '马上拍一张' | |
BW::Device.camera.rear.picture(media_types: [:movie, :image]) do |result| | |
set_photo(result[:original_image]) | |
end | |
when '从手机相册选择' | |
BW::Device.camera.any.picture(media_types: [:movie, :image]) do |result| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_local_notification | |
local_noti = UILocalNotification.alloc.init | |
return if local_noti.nil? | |
NSLog("添加本地消息通知") | |
now = NSDate.now | |
# 触发通知的时间 | |
local_noti.fireDate = now.dateByAddingTimeInterval(10) | |
# 循环次数,kCFCalendarUnitWeekday一周一次 | |
local_noti.repeatInterval =0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
实现以下三个方法,如果弹出的键盘会遮住输入框 ,整体的界面会向上移动,这样就不会遮住输入框了。自己增加UITextFieldDelegate委托。 | |
只适合iPhone,如果想要支持iPad,只要把216改成iPad上面键盘的高度即可。 | |
- (void)keyboardWillShow:(NSNotification *)noti | |
{ | |
//键盘输入的界面调整 | |
//键盘的高度 | |
float height = 216.0; | |
CGRect frame = self.view.frame; | |
frame.size = CGSizeMake(frame.size.width, frame.size.height - height); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[UIApplication sharedApplication] openURL: @"sms:12345678"]; | |
MFMessageComposeViewController *controller = [[[MFMessageComposeViewControlleralloc] init] autorelease]; | |
if([MFMessageComposeViewControllercanSendText]) | |
{ | |
controller.body= @"SMS content"; | |
# 接收短信人的号码 | |
controller.recipients = [NSArrayarrayWithObjects:@"12345678", @"87654321", nil]; | |
controller.messageComposeDelegate =self; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
先在App的入口文件[YourPrefix]AppDelegate定义 | |
#define AppDelegate (XYAppDelegate *)[[UIApplication sharedApplication] delegate] | |
全局变量定义为AppDelegate的属性 | |
然后在项目的其他文件中引入 AppDelegate.h | |
使用[AppDelegate 全局变量]就可以访问全局变量,比如baseURL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
调试技术,跟踪输出来源,DLog和ALog | |
#ifdef DEBUG | |
#define DLog(fmt, ...) | |
NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); | |
#else | |
#define DLog(...) | |
#endif | |
// ALog always displays output regardless of the DEBUG setting | |
#define ALog(fmt,...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__,##__VA_ARGS__); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://somerandomdude.com/articles/design-technology/font-embedding-icons/ | |
The basic idea is to generate a font containing your icons (much like wingding font sets), embedding that font using the @font-face CSS rule and taking advantage of the :before selector and content rule to inject a character bound to a specific icon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# This work is licensed under a Creative Commons Attribution 3.0 Unported License. | |
# http://creativecommons.org/licenses/by/3.0/ | |
# | |
# With some slight modifications, this script should create | |
# a new discount code for each of the 'live' events which are | |
# owned by the user (who is identified by the user_key value). | |
# | |
# See the above license info and Eventbrite API terms for usage limitations. |