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
CGSize screenSize = [[UIScreen mainScreen] applicationFrame].size; | |
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); | |
CGContextRef ctx = CGBitmapContextCreate(nil, screenSize.width, screenSize.height, 8, 4*(int)screenSize.width, colorSpaceRef, kCGImageAlphaPremultipliedLast); | |
CGContextTranslateCTM(ctx, 0.0, screenSize.height); | |
CGContextScaleCTM(ctx, 1.0, -1.0); | |
[(CALayer*)self.view.layer renderInContext:ctx]; |
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
UIImage *image = [UIImage imageNamed:@"some_image.png"]; | |
CGImageRef tmpImgRef = image.CGImage; | |
//Taking left part of image from 0 to half of width | |
CGImageRef leftImgRef = CGImageCreateWithImageInRect(tmpImgRef, CGRectMake(0, 0, image.size.width/2.0, image.size.height )); | |
UIImage *leftUIImage = [UIImage imageWithCGImage:leftImgRef]; | |
CGImageRelease(leftImgRef); | |
//Taking right of image from half of width to full width | |
CGImageRef rightImgRef = CGImageCreateWithImageInRect(tmpImgRef, CGRectMake(image.size.width / 2.0, 0, image.size.width/2.0, image.size.height)); |
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
CGRect someUIElementFrame = _someUIElement.frame; | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.3]; | |
// [UIView setAnimationDelay:1.0]; | |
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; | |
someUIElementFrame.origin.x=-120; | |
[_someUIElement setFrame:leftsomeUIElementFrameImageFrame]; |
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
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:[NSDate date]]; | |
long showMonth=(long)[components month]; | |
long showDay=(long)[components day]; | |
long showYear=(long)[components year]; | |
long showHours=[[partsOfTime objectAtIndex:0] longLongValue]; | |
long showMinutes=[[partsOfTime objectAtIndex:1] longLongValue]; |
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 AppDelegate.m | |
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { | |
[self showAlarm:notification.alertBody]; | |
application.applicationIconBadgeNumber = 0; | |
NSLog(@"AppDelegate didReceiveLocalNotification %@", notification.userInfo); | |
} | |
- (void)showAlarm:(NSString *)text { | |
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"TVVodič alarm" |
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
ACAccount *account=nil; | |
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType]; | |
if([accountsArray count]>0){ | |
account=[accountsArray objectAtIndex:0]; | |
} | |
NSDictionary *tempDict = [[NSMutableDictionary alloc] initWithDictionary: | |
[account dictionaryWithValuesForKeys:[NSArray arrayWithObject:@"properties"]]]; | |
NSString *userId = [[tempDict objectForKey:@"properties"] objectForKey:@"user_id"]; |
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 suboricess | |
child = subprocess.Popen("python called.py", shell=True) |
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
/*It is common request by client to enable opening links in strings in your application. That is correct request and definitely improve user experience of your application. | |
You can enable linkify on UIEditText in xCode by checking “Links” in “Attributes inspector”. | |
This will guide user to the system browser that will open clicked URL. | |
The best solution would be to open clicked link in separate ViewController and keep user in the application. | |
Here, came in hand small amount of code written by nbuggia. | |
Details on http://mycode.restservices.org/2013/06/10/linkify-edit-text-with-custom-viewcontroller/ |
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
package rs.webnet.locmar; | |
import android.content.Context; | |
import android.graphics.Matrix; | |
import android.graphics.PointF; | |
import android.util.FloatMath; | |
import android.util.Log; | |
import android.view.Display; | |
import android.view.GestureDetector; | |
import android.view.MotionEvent; |
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 void removeStatusBar() { | |
if (Build.VERSION.SDK_INT < 16) { | |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | |
} else { | |
View decorView = getWindow().getDecorView(); | |
// Hide the status bar. | |
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; | |
decorView.setSystemUiVisibility(uiOptions); | |
} | |
} |
OlderNewer