1. "Add toolbar to the bottom"

    Mon 11 May 2009

    // Implement loadView to create a view hierarchy programmatically, without using a nib.

    - (void)loadView {

    [super loadView];

     

    UIToolbar *toolbar = [UIToolbar new];

    toolbar.barStyle = UIBarStyleBlackTranslucent;

    // create a bordered style button with custom title

    UIBarButtonItem *playItem = [[[UIBarButtonItem alloc] initWithTitle:@"Play"

                                                  style:UIBarButtonItemStyleBordered

         target:self

         action:@selector(playAction:)] autorelease];

     

    UIBarButtonItem *emailItem = [[[UIBarButtonItem alloc ...

    read more
  2. "Clear UIView during drawing"

    Mon 11 May 2009

    //Please note. To make view transparent you need to add:

    //self.backgroundColor = [UIColor clearColor];

     

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextClearRect(context, self.bounds);


    read more
  3. "Create UILabel in runtime"

    Mon 11 May 2009

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 50, 70)];

    label.numberOfLines = 2;

    label.text@"text";

    label.backgroundColor = [UIColor clearColor];

    label.textColor = [UIColor blackColor];

     

    label.highlightedTextColor = [UIColor blackColor];

    label.textAlignment = UITextAlignmentLeft;

    label.font = [UIFont systemFontOfSize:12];

    [self.view addSubview:label];

    [label release];

     


    read more
  4. "Hide navigation bar for navigation controller"

    Mon 11 May 2009

    - (void)viewWillAppear:(BOOL)animated {

        [super viewWillAppear:animated];

    [self navigationController].navigationBarHidden = YES;

    }

    - (void)viewDidDisappear:(BOOL)animated {

    [self navigationController].navigationBarHidden = NO;

    }


    read more
  5. "Run method in background"

    Mon 11 May 2009

    [NSThread detachNewThreadSelector:@selector(doSomethingInBack:) toTarget:self withObject:nil];

     

    -(void) doSomethingInBack:(id)anObject {

    NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];

     

    //place code you want to run in different thread HERE

     

    [NSThread exit];

    //we need to do this to prevent memory leaks

    [autoreleasepool release];

    }

    read more
  6. "Send email with attachments on iPhone"

    Mon 11 May 2009

    //Additionals acctions to do:

    //  - add source code from attached ZIP;

    //  - add CFNetwork.framework to project;

    //  - your class should implement <SKPSMTPMessageDelegate> protocol.

     

    #import "SKPSMTPMessage.h"

    #import "NSData+Base64Additions.h"

    #import <SystemConfiguration/SCNetworkReachability.h>

    #include <netinet/in.h>

     

    - (void)sendMessageInBack:(id)anObject{

    NSLog(@"Start Sending");

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSString ...

    read more

« Page 11 / 13 »