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
#include <netinet/in.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
- (void)broadCast | |
{ | |
int socketSD = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); | |
if (socketSD <= 0) { | |
NSLog(@"Error: Could not open socket."); |
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
UIBezierPath *maskPath; | |
maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 200, 200) byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(10.0, 10.0)]; | |
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; | |
maskLayer.frame = CGRectMake(0, 0, 200, 200); | |
maskLayer.path = maskPath.CGPath; | |
self.imageView.layer.mask = maskLayer; |
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
- (IBAction)logOutButton:(id)sender | |
{ | |
//show confirmation message to user | |
CustomAlert* alert = [[CustomAlert alloc] initWithTitle:@"Confirmation" message:@"Do you want to exit?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; | |
alert.style = AlertStyleWhite; | |
[alert setFontName:@"Helvetica" fontColor:[UIColor blackColor] fontShadowColor:[UIColor clearColor]]; | |
[alert show]; | |
} | |
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex | |
{ |
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
iPhone iOS 5,6 Spotlight | |
iOS 5-7 Settings | |
1x 2x | |
29pt 58pt | |
iOS 7 Spotlight | |
2x | |
80pt | |
iOS 5,6 App |
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
NSLocale *lcl = [[NSLocale alloc] initWithLocaleIdentifier:@"en_SG"]; | |
NSNumberFormatter *fmtr = [[NSNumberFormatter alloc] init]; | |
[fmtr setNumberStyle:NSNumberFormatterCurrencyStyle]; | |
[fmtr setLocale:lcl]; | |
NSLog(@"Current Locale: %@", [NSLocale currentLocale]); | |
NSLog(@"Available Locales: %@",[NSLocale availableLocaleIdentifiers]); | |
NSLog( @"%@", [lcl displayNameForKey:NSLocaleCurrencySymbol value:@"en_SG"] ); | |
NSLog( @"%@", [fmtr currencySymbol] ); | |
NSLog(@"CurrencyCode: %@", [lcl objectForKey:NSLocaleCurrencyCode]); |
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
// in your subclass of UIScrollView | |
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
if (!self.dragging) { | |
[self.nextResponder touchesBegan:touches withEvent:event]; | |
} | |
else { | |
[super touchesBegan:touches withEvent:event]; | |
} |
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
private boolean keepLooping = true; | |
private static final int DELAY = 1000 * 5; | |
final Handler printHandler = new Handler(); | |
Runnable printStuff = new Runnable(){ | |
@Override | |
public void run(){ | |
System.out.println("done"); | |
if(keepLooping) | |
printHandler.postDelayed(this, DELAY); |