Creating an UIImage from a URL

iPhone SDK Tips & Tricks

NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];

iPhone Vibrate

iPhone SDK Tips & Tricks


AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

Don't forget to import AudioServices.h:
#import <AudioToolbox/AudioServices.h>

Text Button Alignment

iPhone SDK Tips & Tricks


UIButton *accountButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
accountButton.frame = CGRectMake(10, 40, 100, 45); // size and position of button
[accountButton setTitle:@"label" forState:UIControlStateNormal];
accountButton.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom;


typedef enum {
UIControlContentVerticalAlignmentCenter = 0,
UIControlContentVerticalAlignmentTop = 1,
UIControlContentVerticalAlignmentBottom = 2,
UIControlContentVerticalAlignmentFill = 3,
} UIControlContentVerticalAlignment;


typedef enum {
UIControlContentHorizontalAlignmentCenter = 0,
UIControlContentHorizontalAlignmentLeft = 1,
UIControlContentHorizontalAlignmentRight = 2,
UIControlContentHorizontalAlignmentFill = 3,
} UIControlContentHorizontalAlignment;

Close the app in iPhone ios4

iPhone SDK Tips & Tricks

Go to info.plist. Right click on any line, select Add Row

Add UIApplicationExitsOnSuspend, and select Boolean for the Value Type.
Make sure it is checked.

How to show volume control

iPhone SDK Tips & Tricks

MPVolumeView *volumeView = [[[MPVolumeView alloc] initWithFrame:CGRectMake(0, 5, 150, 0)] autorelease];
[volumeView sizeToFit];
[self.view addSubview:volumeView];

Trio Hasim Logo v1.0

Jreng.... jreng.... jreng.......

Bapak-bapak, ibu-ibu, mbak-mbak, mas-mas, adik-adik, semuanya.. tepuk tangan dan bersiaplah untuk terpukau..

Kami dengan bangga mempersembahkan:


Trio Hasim Logo

Ini adalah logo Trio Hasim. Logo ini terdiri dari 3 warna utama yang merupakan perwakilan dari kami bertiga. Untuk kedepan kami masih akan mengembangkan lagi (cambuk2 kucing item biar kerja).

Nantikan logo terbaru yang akan membuat anda terkagum-kagum (janji muluk).

Change pickerview font size

iPhone SDK Tips & Tricks

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UIFont *font = [UIFont boldSystemFontOfSize:16];
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 0, 280, 40)];
myLabel.text = [accountNameArray objectAtIndex:(int)row];
myLabel.textColor = [UIColor blackColor];
myLabel.font = font;
myLabel.backgroundColor = [UIColor clearColor];
myLabel.opaque = NO;
[view addSubview:myLabel];
return myLabel;
}

Title Button with Shadow

iPhone SDK Tips & Tricks

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(110, 270, 100, 35); // size and position of button
[button setTitle:@"OK" forState:UIControlStateNormal];
[button addTarget:self action:@selector(login:) forControlEvents:UIControlEventTouchUpInside];
button.backgroundColor = [UIColor clearColor];
button.adjustsImageWhenHighlighted = YES;
[button setTitleShadowColor:[UIColor redColor] forState:UIControlStateNormal];
button.titleLabel.shadowOffset = CGSizeMake(2, 0.75);

CerBer (Esmeralda & Alexandro)

Yup... lagi2 KucingLorenk n KucingItem stress berat... kali ini KucingLorenk memutuskan buat mengambil tema telenovela untuk cerita bersambung kami... walo banyak percakapan OOT nya, tapi kami tetep enjoy pas bikin cerber kali ini XD... langsung mulai aja yok~~

KucingLorenk = lorenk, KucingItem = item

item : gmn klo kita bikin cerita aja?
lorenk : hooo
lorenk : cerita telenovela ya
lorenk : tidakk alexsandrooo.. lepaskan pisau itu~~
lorenk : *alexandro ya hrsnya?
item : eh bole juga!
item : ala telenovela ato serial cantik
item : yok coba
lorenk : ya uda
lorenk : teruskanla
item : ini semua sudah terlambat esmeralda..... tidak bisa di maafkan!!!!
lorenk : tapi alexandro, tak ada gunanya kau bunuh aku...
item : kau...kau...kau lah penyebab semua musibah ini esmeralda....
lorenk : btw esmeralda itu lawan maennya jose armando, bkn alexandro..
lorenk : lebih baik.. kau balaskan dahulu dendam pembunuh kakakmu itu dahulu...
item : *trus lawan maen nya alexandro sapa?*
item : *kenapa dahulu nya 2x?*
lorenk : *lg googling blom nemu neh..
lorenk : *ya coret 1 dahulunya la, kesalahan terletak di naskah
item : ohh esmeralda!!!! berikan aku kekuatan untuk menemukan pembunuh kakakku!! *alexandro menjatuhkan pisau nya dan memeluk esmeralda sambil menangis*
lorenk : baik ndro, mari kita berdoa bersama. *lalu esmeralda berlutut dan berdoa memohon bantuan
item : *nickname nya ga keren!*
lorenk : *emoticon ketawa*
lorenk : biar agak terawa jowo dikit laa
lorenk : ntar tuh ndro disekitar tubuhnya ada lapisan putih bersinar
item : iki pie?
lorenk : *ndro's all stat +10
item : *ndro's learn new skill "Judgement Day"
lorenk : hoaa @_@
lorenk : *sfx cring2x
lorenk : majulah ndro!! sekarang kau sudah siap, doaku selalu bersamamu!!
item : esmeralda! tunggu lah diriku kembali....
lorenk : pasti.. selalu... tetaplah hidup untukku~~
lorenk : *trus esmeraldanya bobo nungguin dia pulang ya
item : *sidestory... petualangan bang ndro*
lorenk : hmmm...
lorenk : ganti jadi RPG aja deh..
item : lho?
lorenk : abis...
lorenk : ya uda deh
lorenk : biar cepet selese, dr pd bersambung
lorenk : Muahahahaha~~ akulah jose armando, pembunuh kakakmu!!
lorenk : duh org gilanya lg kumat didpn...
item : mana org gila?
item : lg kumat di dpn rmh?
lorenk : itu ga jelas, lg mintain ktp...
item : huhhh?
lorenk : ho oh...
item : ok...
item : eh lanjut si ndro..
item : Jose Armando!!!! kau pembunuh!!!
lorenk : bentar..
lorenk : lg maen http://www.free-iqtest.net/
item : hohh?
item : lg menanti jam pulang
lorenk : hoo
lorenk : itu bersambung deh
lorenk : heuheuheuheu
item : si ndro ya?
item : yahhhhh
item : ga bakal berlanjut..
item : save is
lorenk : hooo
lorenk : ok

String Character Length Count

iPhone SDK Tips & Tricks

NSString *myString = @"Trio Hasim are the best";
NSLog(@"%d", myString.length); //23