1
2 3 4 |
UIButton* customBackButton = [UIButton buttonWithType:101];
[customBackButton setTitle:@"Back" forState:UIControlStateNormal]; [customBackButton setCenter:self.view.center]; [self.view addSubview:customBackButton]; |
UI
Simple EKDemo – EKEvent
Now we have controller for creating events. This controller included from 4.0 iOS SDK.
The application uses table views to display EKCalendar object and EKEvent objects retrieved from an EKEventStore object. It implements EKEventViewController for viewing and editing existing EKEvents, and uses EKEventEditViewController for creating new EKEvents.
DDProgressView – Custom Progress View
DDProgressView is a custom progress view à la Twitter for iPhone.
DDProgressView works on both iOS and Mac OS. You must also compile the AppKitCompatibility.m file when targeting Mac OS.
Thanks, Damien DeVille!
My Custom UITextView with syntax highlighting
Small feature with UIlabel
Add framework QuartzCore
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#import
UILabel *label = [[UILabel alloc] init]; [label setTextColor:[UIColor whiteColor]]; [label setBackgroundColor:[UIColor darkGrayColor]]; [[label layer] setBorderWidth:2]; [[label layer] setCornerRadius:15]; [[label layer] setBorderColor:[UIColor whiteColor].CGColor]; [label setAlpha:0.8]; [label setTextAlignment:UITextAlignmentCenter]; [label setFrame:CGRectMake(0, 0, 220, 50)]; [label setText:@"Loading..."]; [label setCenter:window.center]; [window addSubview:label]; |
Copy UI for additiolan screen
Пример копирования объектов UI на дополнительный экран
Все очень просто, для копирования необходимо выполнить всего 2 метода.
1
2 3 4 5 |
// copy UI
// archiving data NSData *archivedData = [NSKeyedArchiver archivedDataWithRootObject: window]; //extract data externalWindow = [[NSKeyedUnarchiver unarchiveObjectWithData:archivedData] retain]; |
Внимание: Интерфейс копируется только без картинок, если будут картинки, то получите креш. Так же скопированные объекты не синхронизированны.
Далее исходники и ролик демострирующий результат…
Continue reading
Make gradient on iPhone/iPad
Progress bar of downloading file for iOS
This is a sample UIProgressView subclass that I made that will automatically download a file using various different classes from Foundation, to avoid using the undocumented but present-in-iphone NSURLDownload. Sure, this code isn’t the best, but I like to create things like to this to practice things that I want to learn how to do for an app.
This code is free for you to use for whatever, I could care less. I would suggest taking what’s here however and improving it. If I get some time off school before spring break i’ll make it a lil purdier and reupload.
UIDownloadBar.h
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
//
// UIDownloadBar.h // UIDownloadBar // #import @class UIProgressView; @protocol UIDownloadBarDelegate; @interface UIDownloadBar : UIProgressView { NSURLRequest* DownloadRequest; NSURLConnection* DownloadConnection; NSMutableData* receivedData; NSString* localFilename; id long long bytesReceived; long long expectedBytes; float percentComplete; } - (UIDownloadBar *)initWithURL:(NSURL *)fileURL progressBarFrame:(CGRect)frame timeout:(NSInteger)timeout delegate:(id</uidownloadbardelegate> @property (nonatomic, readonly) NSMutableData* receivedData; @property (nonatomic, readonly, retain) NSURLRequest* DownloadRequest; @property (nonatomic, readonly, retain) NSURLConnection* DownloadConnection; @property (nonatomic, assign) id</uidownloadbardelegate> @property (nonatomic, readonly) float percentComplete; @end @protocol UIDownloadBarDelegate @optional - (void)downloadBar:(UIDownloadBar *)downloadBar didFinishWithData:(NSData *)fileData suggestedFilename:(NSString *)filename; - (void)downloadBar:(UIDownloadBar *)downloadBar didFailWithError:(NSError *)error; - (void)downloadBarUpdated:(UIDownloadBar *)downloadBar; @end </nsobject></uidownloadbardelegate></uikit> |
Continue reading