Skip to content

Instantly share code, notes, and snippets.

View marutanm's full-sized avatar
👁️‍🗨️

Ryo Fujita marutanm

👁️‍🗨️
View GitHub Profile
// method name
NSLog(@"%s", __func__);
// CGRect
CGRect rect = CGRectMake(100, 100, 100, 100);
NSLog(@"rect: %@", NSStringFromCGRect(rect));
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@marutanm
marutanm / gist:449895
Created June 23, 2010 13:11
Set git path to MacVim
:let $PATH .= ':/usr/local/git/bin'
@marutanm
marutanm / ScrollViewDelegate.h
Created June 23, 2010 14:20
show UIPageControl only scrolling
#import <UIKit/UIKit.h>
@interface ScrollViewDelegate : UIView <UIScrollViewDelegate> {
UIPageControl *pageControl;
NSTimer *updateTimer;
}
- (void)switchStateHidden;
@end
-(void)startAnimation:(id)sender{
UIButton *btn = (UIButton *)sender;
[btn animateWithDuration:0.5
animations:^{ view.center = CGPointMake(0,0); }
// completion:^(BOOL finished){ [self endAnimation]; }
];
}
// 例として、アニメーションの逆再生かつ繰り返しを指定
// 加算
[UIView animateWithDuration:0 delay:0
options: UIViewAnimationOptionRepeat + UIViewAnimationOptionAutoreverse
animations:NULL completion:NULL ];
// カンマ区切り(要カッコ)
[UIView animateWithDuration:0 delay:0
options: (UIViewAnimationOptionRepeat, UIViewAnimationOptionAutoreverse)
@marutanm
marutanm / UniversalApp_main.m
Created July 19, 2010 02:05
distinguish iPad/iPhone
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal;
if ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate_iPad");
else
retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate_iPhone");
@marutanm
marutanm / .gitignore
Created July 19, 2010 02:06
.gitignore for iPhone/iPad Dev.
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
/build
Classes/.*
@marutanm
marutanm / AppDelegate.m
Created August 17, 2010 12:35
application:didFinishLaunchingWithOptions:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *viewController = [[UIViewController alloc] init];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
@marutanm
marutanm / modalView.m
Created August 17, 2010 14:13
display modalView
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
NSLog(@"%s", __func__);
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view.backgroundColor = [UIColor whiteColor];
viewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:viewController animated:YES];
}