Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SZanlongo committed Jan 12, 2014
0 parents commit 8a64ea8
Show file tree
Hide file tree
Showing 43 changed files with 172 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OS X
.DS_Store

# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa

# CocoaPods
Pods
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ToolBox - Objective-C</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
3 changes: 3 additions & 0 deletions Date and Time/currentDataTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//Get Current Date and time:
NSCalendar *gregorian = [NSCalendar currentCalendar];
NSDateComponents *dateComponents = [gregorian components:(NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit) fromDate:[NSDate date]];
2 changes: 2 additions & 0 deletions Files/copyFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Copy a file from x to y
[[NSFileManager defaultManager] copyItemAtPath:x toPath:y error:nil];
3 changes: 3 additions & 0 deletions Files/documentsFolderPath
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//Get the path to the Documents folder:
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
2 changes: 2 additions & 0 deletions Launch Applications/dialPhoneNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Dial a Phone Number (iPhone Only)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://9662256888"]];
3 changes: 3 additions & 0 deletions Launch Applications/googleMaps
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//Open Google Maps app with directions between two lat/long points
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&dirflg=d", start.latitude, start.longitude, finish.latitude, finish.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
2 changes: 2 additions & 0 deletions Launch Applications/launchMail
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Launch the Apple Mail
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://[email protected]"]];
2 changes: 2 additions & 0 deletions Launch Applications/launchMessages
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Open the Messages app with a specific phone number:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:123456789"]];
2 changes: 2 additions & 0 deletions Launch Applications/launchSafari
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Open an URL in Safari
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com/"]];
10 changes: 10 additions & 0 deletions Launch Applications/numberofLaunches
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NSUserDefaults *countDefaults;
int launchCount;

countDefaults = [NSUserDefaults standardUserDefaults];
launchCount = [countDefaults integerForKey:@"launchCount" ] + 1;
[countDefaults setInteger:launchCount forKey:@"launchCount"];
[countDefaults synchronize];


NSLog(@"Launch number: %i", launchCount);
4 changes: 4 additions & 0 deletions Methods/checkObjectSupportsMethod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//Check to make sure an objects support a method before calling it:
if ([item respondsToSelector:@selector(activateBOP:)]) {
[item activateBOP:closeBOP];
}
2 changes: 2 additions & 0 deletions Methods/logNameOfClassAndFunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Log the name of the class and function:
NSLog(@"%s", __PRETTY_FUNCTION__);
2 changes: 2 additions & 0 deletions Navigation/UITabBarBackground
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UIImage *tabBarBackground = [UIImage imageNamed:@"TabBarOverlay.png"];
[rootController.tabBar setBackgroundImage:tabBarBackground];
2 changes: 2 additions & 0 deletions Navigation/blackStatusBar
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Change the status bar to black
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
1 change: 1 addition & 0 deletions Navigation/hideBackButton
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
self.navigationItem.hidesBackButton = YES;
2 changes: 2 additions & 0 deletions Navigation/hideStatusBar.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Hide the status bar
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
2 changes: 2 additions & 0 deletions Navigation/navBarStyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Change the style of the navigation bar (from in a view controller):
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
5 changes: 5 additions & 0 deletions Network/network
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//Show the network Activity Indicator
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

//Hide the network Activity Indicator
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
2 changes: 2 additions & 0 deletions Power/power
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Prevents iPhone goes into sleep mode
[UIApplication sharedApplication].idleTimerDisabled = YES;
3 changes: 3 additions & 0 deletions Touch Events/screenTouches
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//Screen touches method

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {}
5 changes: 5 additions & 0 deletions Touch Events/startStopResponding
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//stop responding to touch events
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

//activate the touch events
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
4 changes: 4 additions & 0 deletions Types/customEnumType
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//Own enum type:
typedef enum {
a = 0, b = 1, c = 2
} enumName;
1 change: 1 addition & 0 deletions UILabel/alignText
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
titleLabel.textAlignment = UITextAlignmentCenter;
1 change: 1 addition & 0 deletions UILabel/fontSize
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[textView setFont:[UIFont fontWithName:@"Helvetica" size:16]];
2 changes: 2 additions & 0 deletions UIScrollView/configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320, 1400)];
23 changes: 23 additions & 0 deletions UITableView/tableViewTemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:cellIdentifier];
// Do something here......................
}
// Do something here too .........................
return cell;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return ;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return ;
}
1 change: 1 addition & 0 deletions UITextView/fontAndSize
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[thankYouTextView setFont:[UIFont fontWithName:@"Helvetica" size:16]];
3 changes: 3 additions & 0 deletions UIView/alertWindow
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//Display an alert window:
UIAlertView* alert = [[[UIAlertView alloc] initWithTitle:@"Warning" message:@"too many alerts" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
[alert show]
1 change: 1 addition & 0 deletions UIView/backgroundColor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
self.view.backgroundColor = [UIColor colorWithHue:1.0 saturation:0.0 brightness:0.6 alpha:1.0];
8 changes: 8 additions & 0 deletions UIView/changeBackButtonTitle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//Change the title on the back button on a UINavigationView.
//Use this code on the UINavigationController before pushing the view

UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style: UIBarButtonItemStyleBordered target:nil action:nil];


self.navigationItem.backBarButtonItem = backBarButtonItem;
[backBarButtonItem release];
2 changes: 2 additions & 0 deletions UIView/displayNewView
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Display a new view
[self presentModalViewController:(UIViewController *) animated:YES];
5 changes: 5 additions & 0 deletions UIView/fadeAwayUIView
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//Fade away a UIView by animating the alpha down to 0:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1]; // fade away over 1 seconds
[aView setAlpha:0];
[UIView commitAnimations];
2 changes: 2 additions & 0 deletions UIView/getAppName
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Get the name of the app
self.title = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
2 changes: 2 additions & 0 deletions UIView/notificationBadge
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//red notification badge on app
[UIApplication sharedApplication].applicationIconBadgeNumber = 10;
2 changes: 2 additions & 0 deletions UIView/pushViewToNavBar
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Push another view controller onto the Navigation Bar:
[self.navigationController pushViewController:anotherVC animated:YES];
3 changes: 3 additions & 0 deletions UIView/quartzDrawArc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//Quartz draw arc
CGContextRef ctxt = UIGraphicsGetCurrentContext();
CGContextAddArc(ctxt, x, y, radius, startDeg, endDeg);
4 changes: 4 additions & 0 deletions UIView/roundedCornerOrBorder
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//Add rounded corners and/or a border around any UIView item (self)
self.layer.borderColor = [UIColor whiteColor].
self.layer.cornerRadius = 8; // rounded corners
self.layer.masksToBounds = YES; // prevent drawing outside border
1 change: 1 addition & 0 deletions UIView/setTitle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
viewController.title = @"Title Here...";
3 changes: 3 additions & 0 deletions UIViewController/presentViewController
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ViewController *viewController = [[ViewController alloc] init];
viewController = @"Title Here...";
[self.navigationController viewController animated:YES];
2 changes: 2 additions & 0 deletions User Defaults/saveBoolToUserDefaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Save bool to User Defaults
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"Yes Bool"];
7 changes: 7 additions & 0 deletions User Defaults/saveOrGetStringToUserDefaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//Save a NSString into NSUserDefaults:
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:loginName forKey:kUserLoginName];

//Get an NSString from NSUserDefaults:
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString* loginName = [defaults stringForKey:kUserLoginName];
2 changes: 2 additions & 0 deletions Vibrate/vibrate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//Make the device vibrate:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

0 comments on commit 8a64ea8

Please sign in to comment.