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
| #import <UIKit/UIKit.h> | |
| @interface UIViewController (JTCAddition) | |
| +(instancetype) viewControllerFromSameNameStoryboard; | |
| +(UINavigationController*) viewControllerFromSameNameStoryboardInNavigationController; | |
| @end |
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
| +(NSAttributedString*)attributedStringFromString:(NSString*)string font:(UIFont*)font color:(UIColor*)color{ | |
| if (string==nil || ![string isKindOfClass:[NSString class]]) { | |
| return [[NSAttributedString alloc] initWithString:@"" attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:color}]; | |
| } | |
| NSMutableAttributedString * attrib = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:color}]; | |
| NSArray * array = [TwitterText entitiesInText:attrib.string]; | |
| [array enumerateObjectsUsingBlock:^(TwitterTextEntity * obj, NSUInteger idx, BOOL *stop) { | |
| if (obj.type==TwitterTextEntityURL) { | |
| NSURL * url = [NSURL URLWithString:[string substringWithRange:obj.range]]; | |
| if (url) { |
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
| NSMutableAttributedString * mutable = [[NSMutableAttributedString alloc] init]; | |
| [mutable appendAttributedString:[[NSMutableAttributedString alloc] initWithString:self.user.name attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:12*TOVConstSizeRate]}]]; | |
| [mutable appendAttributedString:[[NSMutableAttributedString alloc] initWithString:@" " attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:6*TOVConstSizeRate]}]]; | |
| [mutable appendAttributedString:[[NSMutableAttributedString alloc] initWithString:@"(@" attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:11*TOVConstSizeRate]}]]; | |
| [mutable appendAttributedString:[[NSMutableAttributedString alloc] initWithString:self.user.screenName attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:11*TOVConstSizeRate]}]]; | |
| [mutable appendAttributedString:[[NSMutableAttributedString alloc] initWithString:@")\t" attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:11*TOVConstSizeRate]}]]; | |
| [mutable appendAt |
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
| -(BOOL)isFirstResponderRecursive{ | |
| if (self.isFirstResponder) { | |
| return YES; | |
| } | |
| for (UIView * sub in self.subviews) { | |
| if ([sub isFirstResponderRecursive]) { | |
| return YES; | |
| } | |
| } | |
| return NO; |
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
| // 読み上げオブジェクト | |
| AVSpeechSynthesizer * synthesizer = [[AVSpeechSynthesizer alloc] init]; | |
| // 読み上げる内容 | |
| AVSpeechUtterance * utterance = [[AVSpeechUtterance alloc] initWithString:NSLocalizedString(@"Welcome to Tweet Overview ", nil)]; | |
| // 読み上げる言語の設定 | |
| utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"ja-JP"]; | |
| utterance.pitchMultiplier = 1.0; | |
| // 読み上げる | |
| [synthesizer speakUtterance:utterance]; |
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
| @interface ALAssetsLibrary (JTCCommon) | |
| -(ALAsset*) getSyncAssetFromURL:(NSURL*)url; | |
| -(UIImage*) getSyncFullScreenImageFromURL:(NSURL*)url; | |
| -(UIImage*) getSyncFullResolutionImageFromURL:(NSURL*)url; | |
| -(UIImage*) getSyncThumbnailImageFromURL:(NSURL*)url; | |
| -(UIImage*) getSyncAspectThumbnailImageFromURL:(NSURL*)url; | |
| @end |
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
| AFHTTPClient *client = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:domain]]; | |
| [client registerHTTPOperationClass:[AFHTTPRequestOperation class]]; | |
| NSMutableDictionary* dicParam = [parameters mutableCopy]; | |
| NSMutableURLRequest *request = [client requestWithMethod:@"POST" path:@"/api/path" parameters:dicParam]; | |
| [request setTimeoutInterval:20]; | |
| AFHTTPRequestOperation *operation = [client HTTPRequestOperationWithRequest:request success:^{...} failure:^{...}]; | |
| [client enqueueHTTPRequestOperation:operation]; |
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
| // | |
| // ViewController.m | |
| // TestUIWebView | |
| // | |
| // Created by Tomohisa Takaoka on 11/5/12. | |
| // Copyright (c) 2012 Tomohisa Takaoka. All rights reserved. | |
| // | |
| #import "ViewController.h" |
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
| -(IBAction) compose:(id)sender{ | |
| TWTweetComposeViewController *tweet = [[TWTweetComposeViewController alloc] init]; | |
| [tweet setInitialText:[@" #test"]]; | |
| int64_t delayInSeconds = 0.5; | |
| dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | |
| dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | |
| [self searchSubviewRecursive:[[UIApplication sharedApplication] keyWindow]]; | |
| }); | |
| [[TOVAppDelegate sharedDelegate].viewController presentModalViewController:tweet animated:YES]; | |
| } |
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
| - (void)didReceiveMemoryWarning { | |
| if([self isViewLoaded] && [self.view window] == nil) { | |
| [photoMap removeAllObjects]; | |
| self.view = nil; | |
| self.photoImageView = nil; | |
| } | |
| } |