This file contains 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
// Simple Frame Property | |
@interface UIView(FrameUtil) | |
@property (nonatomic,assign) float originX; | |
@property (nonatomic,assign) float originY; | |
@property (nonatomic,assign) float width; | |
@property (nonatomic,assign) float height; | |
@property (nonatomic,assign) CGSize size; | |
@property (nonatomic,assign) CGPoint origin; | |
@end |
This file contains 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 <stdarg.h> | |
void myLog(NSString *message,...); | |
@interface ViewController : UIViewController | |
- (void)myLog:(NSString *)message,... NS_REQUIRES_NIL_TERMINATION; | |
@end | |
void myLog(NSString *message,...) { | |
va_list list; |
This file contains 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
NSTask *task = [[NSTask alloc] init]; | |
NSPipe *pipe = [[NSPipe alloc] init]; | |
[task setStandardOutput:pipe]; | |
NSString *launchPath = @"/Applications/Preview.app/Contents/MacOS/Preview"; | |
NSArray *args_ = [NSArray arrayWithObjects:@"/Users/katagiriso/Documents/tmp.pdf",nil]; | |
[task setLaunchPath:launchPath]; | |
[task setArguments:args_]; |
This file contains 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
[UIView beginAnimations:nil context:NULL]; | |
[UIView setAnimationDuration:1.0]; | |
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; | |
[self setFrame:CGRectMake(moveToPoint.x, moveToPoint.y, self.frame.size.width, self.frame.size.height)]; | |
[UIView commitAnimations]; |
This file contains 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)setColor:(UIView *)v | |
{ | |
static int i = 0; | |
NSArray* colors = [NSArray arrayWithObjects:[UIColor redColor],[UIColor blueColor],[UIColor yellowColor],[UIColor greenColor],[UIColor purpleColor],[UIColor blackColor],[UIColor lightGrayColor],nil]; | |
[v setBackgroundColor:[colors objectAtIndex:i]]; | |
i++; | |
if (i>= [colors count]) { | |
i = 0; | |
} | |
} |
This file contains 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
NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; | |
NSArray *names = [[NSFileManager defaultManager] directoryContentsAtPath:resourcePath]; |
This file contains 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
if (num != 0) {...} |
This file contains 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
time_t start, end; | |
start = clock(); | |
... | |
end = clock(); | |
NSLog(@" => time %ld",test,(end - start)); |
This file contains 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)scrollViewDidScroll:(UIScrollView *)scrollView; | |
// ズームした | |
- (void)scrollViewDidZoom:(UIScrollView *)scrollView NS_AVAILABLE_IOS(3_2); | |
// ドラッグがはじまっった。 | |
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView; |
This file contains 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
<html> | |
<head> | |
<title>Sample</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
<!-- | |
dd = new Date(); | |
document.write(dd.toLocaleString()); | |
// --> |
OlderNewer