Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: frankswu/sstoolkit
...
head fork: MugunthKumar/sstoolkit
compare: master
  • 2 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
16 SSToolkit.xcodeproj/project.pbxproj
View
@@ -8,6 +8,8 @@
/* Begin PBXBuildFile section */
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
+ AB3EDE061308FF32007F0BF9 /* UIDevice+MKAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AB3EDE041308FF32007F0BF9 /* UIDevice+MKAdditions.h */; };
+ AB3EDE071308FF32007F0BF9 /* UIDevice+MKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AB3EDE051308FF32007F0BF9 /* UIDevice+MKAdditions.m */; };
B207C63712EA209100412418 /* SSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = B207C63512EA209100412418 /* SSWindow.h */; };
B207C63812EA209100412418 /* SSWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = B207C63612EA209100412418 /* SSWindow.m */; };
B20AC0691267988600687143 /* SSTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B20AC0671267988600687143 /* SSTableViewController.h */; };
@@ -62,8 +64,6 @@
B24E9E74121DC29A0085F81E /* UIColor+SSToolkitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E36121DC29A0085F81E /* UIColor+SSToolkitAdditions.m */; };
B24E9E75121DC29A0085F81E /* UIControl+SSToolkitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = B24E9E37121DC29A0085F81E /* UIControl+SSToolkitAdditions.h */; };
B24E9E76121DC29A0085F81E /* UIControl+SSToolkitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E38121DC29A0085F81E /* UIControl+SSToolkitAdditions.m */; };
- B24E9E77121DC29A0085F81E /* UIDevice+SSToolkitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = B24E9E39121DC29A0085F81E /* UIDevice+SSToolkitAdditions.h */; };
- B24E9E78121DC29A0085F81E /* UIDevice+SSToolkitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E3A121DC29A0085F81E /* UIDevice+SSToolkitAdditions.m */; };
B24E9E79121DC29A0085F81E /* UIImage+SSToolkitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = B24E9E3B121DC29A0085F81E /* UIImage+SSToolkitAdditions.h */; };
B24E9E7A121DC29A0085F81E /* UIImage+SSToolkitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E3C121DC29A0085F81E /* UIImage+SSToolkitAdditions.m */; };
B24E9E7B121DC29A0085F81E /* UIScrollView+SSToolkitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = B24E9E3D121DC29A0085F81E /* UIScrollView+SSToolkitAdditions.h */; };
@@ -108,6 +108,8 @@
/* Begin PBXFileReference section */
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ AB3EDE041308FF32007F0BF9 /* UIDevice+MKAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+MKAdditions.h"; sourceTree = "<group>"; };
+ AB3EDE051308FF32007F0BF9 /* UIDevice+MKAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+MKAdditions.m"; sourceTree = "<group>"; };
B207C63512EA209100412418 /* SSWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSWindow.h; sourceTree = "<group>"; };
B207C63612EA209100412418 /* SSWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSWindow.m; sourceTree = "<group>"; };
B20AC0671267988600687143 /* SSTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSTableViewController.h; sourceTree = "<group>"; };
@@ -163,8 +165,6 @@
B24E9E36121DC29A0085F81E /* UIColor+SSToolkitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+SSToolkitAdditions.m"; sourceTree = "<group>"; };
B24E9E37121DC29A0085F81E /* UIControl+SSToolkitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIControl+SSToolkitAdditions.h"; sourceTree = "<group>"; };
B24E9E38121DC29A0085F81E /* UIControl+SSToolkitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIControl+SSToolkitAdditions.m"; sourceTree = "<group>"; };
- B24E9E39121DC29A0085F81E /* UIDevice+SSToolkitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+SSToolkitAdditions.h"; sourceTree = "<group>"; };
- B24E9E3A121DC29A0085F81E /* UIDevice+SSToolkitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+SSToolkitAdditions.m"; sourceTree = "<group>"; };
B24E9E3B121DC29A0085F81E /* UIImage+SSToolkitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+SSToolkitAdditions.h"; sourceTree = "<group>"; };
B24E9E3C121DC29A0085F81E /* UIImage+SSToolkitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+SSToolkitAdditions.m"; sourceTree = "<group>"; };
B24E9E3D121DC29A0085F81E /* UIScrollView+SSToolkitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+SSToolkitAdditions.h"; sourceTree = "<group>"; };
@@ -315,14 +315,14 @@
B2601A72122307A2005506D5 /* UIKit */ = {
isa = PBXGroup;
children = (
+ AB3EDE041308FF32007F0BF9 /* UIDevice+MKAdditions.h */,
+ AB3EDE051308FF32007F0BF9 /* UIDevice+MKAdditions.m */,
B2AE1132126F963300534CF2 /* UIApplication+SSToolkitAdditions.h */,
B2AE1133126F963300534CF2 /* UIApplication+SSToolkitAdditions.m */,
B24E9E35121DC29A0085F81E /* UIColor+SSToolkitAdditions.h */,
B24E9E36121DC29A0085F81E /* UIColor+SSToolkitAdditions.m */,
B24E9E37121DC29A0085F81E /* UIControl+SSToolkitAdditions.h */,
B24E9E38121DC29A0085F81E /* UIControl+SSToolkitAdditions.m */,
- B24E9E39121DC29A0085F81E /* UIDevice+SSToolkitAdditions.h */,
- B24E9E3A121DC29A0085F81E /* UIDevice+SSToolkitAdditions.m */,
B24E9E3B121DC29A0085F81E /* UIImage+SSToolkitAdditions.h */,
B24E9E3C121DC29A0085F81E /* UIImage+SSToolkitAdditions.m */,
B279539712FC67E300FFE28D /* UIScreen+SSToolkitAdditions.h */,
@@ -472,7 +472,6 @@
B24E9E71121DC29A0085F81E /* SSWebView.h in Headers */,
B24E9E73121DC29A0085F81E /* UIColor+SSToolkitAdditions.h in Headers */,
B24E9E75121DC29A0085F81E /* UIControl+SSToolkitAdditions.h in Headers */,
- B24E9E77121DC29A0085F81E /* UIDevice+SSToolkitAdditions.h in Headers */,
B24E9E79121DC29A0085F81E /* UIImage+SSToolkitAdditions.h in Headers */,
B24E9E7B121DC29A0085F81E /* UIScrollView+SSToolkitAdditions.h in Headers */,
B24E9E7D121DC29A0085F81E /* UIView+SSToolkitAdditions.h in Headers */,
@@ -496,6 +495,7 @@
B2E241541301C71400F7DC3B /* SSAddressBarTextField.h in Headers */,
B2E241561301C71400F7DC3B /* SSAddressBarTextFieldBackgroundView.h in Headers */,
B2E241581301C71400F7DC3B /* SSAddressBarTextFieldBackgroundViewInnerView.h in Headers */,
+ AB3EDE061308FF32007F0BF9 /* UIDevice+MKAdditions.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -572,7 +572,6 @@
B24E9E72121DC29A0085F81E /* SSWebView.m in Sources */,
B24E9E74121DC29A0085F81E /* UIColor+SSToolkitAdditions.m in Sources */,
B24E9E76121DC29A0085F81E /* UIControl+SSToolkitAdditions.m in Sources */,
- B24E9E78121DC29A0085F81E /* UIDevice+SSToolkitAdditions.m in Sources */,
B24E9E7A121DC29A0085F81E /* UIImage+SSToolkitAdditions.m in Sources */,
B24E9E7C121DC29A0085F81E /* UIScrollView+SSToolkitAdditions.m in Sources */,
B24E9E7E121DC29A0085F81E /* UIView+SSToolkitAdditions.m in Sources */,
@@ -597,6 +596,7 @@
B2E241551301C71400F7DC3B /* SSAddressBarTextField.m in Sources */,
B2E241571301C71400F7DC3B /* SSAddressBarTextFieldBackgroundView.m in Sources */,
B2E241591301C71400F7DC3B /* SSAddressBarTextFieldBackgroundViewInnerView.m in Sources */,
+ AB3EDE071308FF32007F0BF9 /* UIDevice+MKAdditions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
2  SSToolkit/UIColor+SSToolkitAdditions.h
View
@@ -9,5 +9,5 @@
@interface UIColor (SSToolkitAdditions)
- (CGFloat)alpha;
-
+- (UIColor*) colorFromHex:(int) hexColor; // Mugunth Kumar
@end
9 SSToolkit/UIColor+SSToolkitAdditions.m
View
@@ -14,4 +14,13 @@ - (CGFloat)alpha {
return CGColorGetAlpha(self.CGColor);
}
+- (UIColor*) colorFromHex:(int) hexColor
+{
+ float redComponent = (float)(((hexColor & 0xFF0000) >> 16)/255.0);
+ float greenComponent = (float)(((hexColor & 0x00FF00) >> 8)/255.0);
+ float blueComponent = (float)((hexColor & 0x0000FF)/255.0);
+
+ return [UIColor colorWithRed:redComponent green:greenComponent blue:blueComponent alpha:1.0];
+}
+
@end
51 SSToolkit/UIDevice+MKAdditions.h
View
@@ -0,0 +1,51 @@
+//
+// UIDevice_MKAdditions.h
+// DeviceHelper
+//
+// Created by Mugunth Kumar on 15-Aug-10.
+// Copyright 2010 Steinlogic. All rights reserved.
+// As a side note on using this code, you might consider giving some credit to me by
+// 1) linking my website from your app's website
+// 2) or crediting me inside the app's credits page
+// 3) or a tweet mentioning @mugunthkumar
+// 4) A paypal donation to mugunth.kumar@gmail.com
+//
+// A note on redistribution
+// if you are re-publishing after editing, please retain the above copyright notices
+
+#import <Foundation/Foundation.h>
+#import <MessageUI/MessageUI.h>
+
+#import <AVFoundation/AVFoundation.h>
+#import <AudioToolbox/AudioServices.h>
+#import <CoreLocation/CoreLocation.h>
+#import <MobileCoreServices/MobileCoreServices.h>
+#import <CoreMotion/CoreMotion.h>
+
+@interface UIDevice (MKAdditions) {
+
+}
+
+- (BOOL) isSimulator; // by Sam Soffes
+- (BOOL) microphoneAvailable;
+- (void) vibrateWithSound;
+- (void) vibrateWithoutSound;
+
+- (BOOL) doesPhotoLibraryHavePictures;
+- (BOOL) doesCameraRollHavePictures;
+
+- (BOOL) cameraAvailable;
+- (BOOL) videoCameraAvailable;
+- (BOOL) frontCameraAvailable;
+- (BOOL) cameraFlashAvailable;
+
+- (BOOL) canSendEmail;
+- (BOOL) canSendSMS;
+- (BOOL) canMakePhoneCalls;
+
+- (BOOL) multitaskingCapable;
+- (BOOL) retinaDisplayCapable;
+
+- (BOOL) compassAvailable;
+- (BOOL) gyroscopeAvailable;
+@end
172 SSToolkit/UIDevice+MKAdditions.m
View
@@ -0,0 +1,172 @@
+//
+// UIDevice_MKAdditions.m
+// DeviceHelper
+//
+// Created by Mugunth Kumar on 15-Aug-10.
+// Copyright 2010 Steinlogic. All rights reserved.
+// As a side note on using this code, you might consider giving some credit to me by
+// 1) linking my website from your app's website
+// 2) or crediting me inside the app's credits page
+// 3) or a tweet mentioning @mugunthkumar
+// 4) A paypal donation to mugunth.kumar@gmail.com
+//
+// A note on redistribution
+// if you are re-publishing after editing, please retain the above copyright notices
+
+#import "UIDevice+MKAdditions.h"
+
+@implementation UIDevice (MKAdditions)
+
+- (BOOL)isSimulator { // by Sam Soffes
+
+ static NSString *simulatorModel = @"iPhone Simulator";
+
+ return [[self model] isEqual:simulatorModel];
+}
+
+- (BOOL) microphoneAvailable
+{
+ AVAudioSession *ptr = [AVAudioSession sharedInstance];
+ return ptr.inputIsAvailable;
+}
+
+- (void) vibrateWithSound
+{
+ AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
+}
+
+-(void) vibrateWithoutSound
+{
+ AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
+}
+
+- (BOOL) doesPhotoLibraryHavePictures
+{
+ return [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary];
+}
+
+- (BOOL) doesCameraRollHavePictures
+{
+ return [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
+}
+
+- (BOOL) cameraAvailable
+{
+ return [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
+}
+
+- (BOOL) videoCameraAvailable
+{
+ UIImagePickerController *picker = [[UIImagePickerController alloc] init];
+ NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
+ [picker release];
+
+ if (![sourceTypes containsObject:(NSString *)kUTTypeMovie ]){
+
+ return NO;
+ }
+
+ return YES;
+}
+
+- (BOOL) frontCameraAvailable
+{
+#ifdef __IPHONE_4_0
+ return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront];
+#else
+ return NO;
+#endif
+
+}
+
+- (BOOL) cameraFlashAvailable
+{
+#ifdef __IPHONE_4_0
+ return [UIImagePickerController isFlashAvailableForCameraDevice:UIImagePickerControllerCameraDeviceRear];
+#else
+ return NO;
+#endif
+}
+
+// later when Apple adds a camera flash to the front camera in iPhone 5 or 6 or whatever, this function can be uncommented :)
+/*
+- (BOOL) isCameraFlashAvailableForFrontCamera
+{
+#ifdef __IPHONE_5_0 or 6?!?
+ return [UIImagePickerController isFlashAvailableForCameraDevice:UIImagePickerControllerCameraDeviceFront];
+#else
+ return NO;
+#endif
+}
+*/
+
+- (BOOL) canSendEmail
+{
+ return [MFMailComposeViewController canSendMail];
+}
+
+- (BOOL) canSendSMS
+{
+#ifdef __IPHONE_4_0
+ return [MFMessageComposeViewController canSendText];
+#else
+ return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"sms://"]];
+#endif
+}
+
+- (BOOL) canMakePhoneCalls
+{
+ return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel://"]];
+}
+
+- (BOOL) multitaskingCapable
+{
+ BOOL backgroundSupported = NO;
+ if ([self respondsToSelector:@selector(isMultitaskingSupported)])
+ backgroundSupported = self.multitaskingCapable;
+
+ return backgroundSupported;
+}
+
+- (BOOL) compassAvailable
+{
+ BOOL compassAvailable = NO;
+
+#ifdef __IPHONE_3_0
+ compassAvailable = [CLLocationManager headingAvailable];
+#else
+ CLLocationManager *cl = [[CLLocationManager alloc] init];
+ compassAvailable = cl.headingAvailable;
+ [cl release];
+#endif
+
+ return compassAvailable;
+
+}
+
+- (BOOL) gyroscopeAvailable
+{
+#ifdef __IPHONE_4_0
+ CMMotionManager *motionManager = [[CMMotionManager alloc] init];
+ BOOL gyroAvailable = motionManager.gyroAvailable;
+ [motionManager release];
+ return gyroAvailable;
+#else
+ return NO;
+#endif
+
+}
+
+
+- (BOOL) retinaDisplayCapable
+{
+ int scale = 1.0;
+ UIScreen *screen = [UIScreen mainScreen];
+ if([screen respondsToSelector:@selector(scale)])
+ scale = screen.scale;
+
+ if(scale == 2.0f) return YES;
+ else return NO;
+}
+
+@end
13 SSToolkit/UIDevice+SSToolkitAdditions.h
View
@@ -1,13 +0,0 @@
-//
-// UIDevice+SSToolkitAdditions.h
-// SSToolkit
-//
-// Created by Sam Soffes on 7/13/09.
-// Copyright 2009-2010 Sam Soffes. All rights reserved.
-//
-
-@interface UIDevice (SSToolkitAdditions)
-
-- (BOOL)isSimulator;
-
-@end
20 SSToolkit/UIDevice+SSToolkitAdditions.m
View
@@ -1,20 +0,0 @@
-//
-// UIDevice+SSToolkitAdditions.m
-// SSToolkit
-//
-// Created by Sam Soffes on 7/13/09.
-// Copyright 2009-2010 Sam Soffes. All rights reserved.
-//
-
-#import "UIDevice+SSToolkitAdditions.h"
-
-@implementation UIDevice (SSToolkitAdditions)
-
-- (BOOL)isSimulator {
-
- static NSString *simulatorModel = @"iPhone Simulator";
-
- return [[self model] isEqual:simulatorModel];
-}
-
-@end
8 SSToolkit/UIViewController+SSToolkitAdditions.m
View
@@ -15,7 +15,13 @@ - (void)displayError:(NSError *)error {
return;
}
- [self displayErrorString:[error localizedDescription]];
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[error localizedFailureReason]
+ message:[error localizedRecoverySuggestion]
+ delegate:self
+ cancelButtonTitle:@"OK"
+ otherButtonTitles:nil];
+ [alert show];
+ [alert release];
}

No commit comments for this range

Something went wrong with that request. Please try again.