Monday, September 7, 2009

Core Data save hiba es NSError Array (1560) kiiratasa

NSManagedObject save metodusa hibat adott amibol nem tudtam meg tul sokat (Operation could not be completed. (Cocoa error 1560.)), de a Stackowerflow-n segitettek:

Eloszor is valamelyik mandatory property-nek nem adtam erteket.

Masodszor pedig azt is megtudtam, hogy nem csak egy sima NSError-t kaptam vissza, hamem egy NSError tombot (ezt jelenti az 1560). Rendesen kiiratni meg igy kell.

UIImage betoltese bundle-bol

Idezve a The Geek Blog-ot:

[UIImage imageWithContentsOfFile:

[[NSBundle mainBundle]

pathForResource:@"thefilename"

ofType:@"jpg"]];

Glyphysh - 120 icons for iPhone applications

Itt van. (Creatitve Commons Attribute licencelt)

UIImage trukkok

Eloszor is kellett egy thumbnail-t kesziteni egy jpg-bol amihez innen szedtem az otletet es igy csinaltam meg:

NSData *imageData = [[NSData alloc] initWithContentsOfFile:filePath];

UIImage *img = [[UIImage alloc] initWithData:imageData];


UIGraphicsBeginImageContext(CGSizeMake(75.0,75.0));

[img drawInRect:CGRectMake(0.0, 0.0, 75.0, 75.0)];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

NSData *thumbData = UIImageJPEGRepresentation(newImage, 0.5);

[thumbData writeToFile:thumbPath atomically:YES];




Aztan itt vannak meg a kovetkezo dolgok:
  • Combine 2 UIImages
  • Create a UIImage from a part of another UIImage
  • Save UIImage to Photo Album

Thursday, September 3, 2009

UITableViewCell beszurasa UITableView-ba

Igy szurunk be egy cellat a TableView elejere:

[self.tableView insertRowsAtIndexPaths:myObject withRowAnimation:UITableViewRowAnimationFade];


Igy pedig feltekerunk, hogy lassuk az uj cellat:

[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];


Wednesday, September 2, 2009

Locating Directories on the System

Igy kell csinalni.

Saturday, August 29, 2009

UIActivityIndicatorView

Igy hivjak a forgo kis kurzort es itt van rola a leiras.

Fontos, hogy a hidesWhenStopped property default YES, tehat ha nem inditjuk el a porgest a startAnimating-gal es nem allitjuk be a hidesWhenStopped-et NO-ra akkor hiaba pakoljuk ki valahova a View-t, nem fogjuk latni.

Tuesday, August 25, 2009

App Icon keszitese

Itt van egy leiras Dustin Yonak-tol.

Monday, August 24, 2009

Hogyan futtassunk az app-unkat iPhone-on, ha mar megvan a licence

A DevClinic-en szepen leirjak.

Publishing Applications for Testing

Itt minden szepen le van irva.

Kepek leszedese iPhone-rol

Az Image Capture megoldja es van egy Cameras nevu plugin ami megkonnyiti a dolgot:

With familiar System Preference functionality, Cameras allows you to manage what happens when you connect your:

  • Digital camera
  • iPhone
  • Digital media reader
  • Any photo device

In addition to launching a specific application when you connect a camera, you can also have your images download automatically. Never again spend time launching the right app or quitting apps that you didn't want to launch.


Friday, August 14, 2009

Maximum hossz beallitas UITextField-ben es UITextView-ban

Itt van egy leiras, de a lenyeg:
  • A View implementalja aUITextViewDelegate vagy UITextFieldDelegate protokollt.
  • UITextView eseten a textView:shouldChangeTextInRange:replacementText method-ban, UITextField eseten pedig a textField:shouldChangeCharactersInRange:replacementString method-ba kell tenni az ellenorzest
Azt kell megnezni, hogy [[textView text] length] > 0 es
range.length == 0
(range.length 1 lesz, ha torlok egy karaktert)
Illetve UITextField eseten textView helyett textField es range helyett string.

Azt nem tudom, hogy ez mukodik-e igy paste-nel is, mert azt meg nem sikerult kiprobalni a Simulatorban.

Nick Dalton: How To Create A Data Entry Screen

Itt van.

Wednesday, August 12, 2009

thumbnail betoltese UITableViewCell-be

Kell egy custom UITableViewCell aminek van egy UIImageView propertyje
pl.:

IBOutlet UIImageView *image;

...

@property (nonatomic, retain) IBOutlet UIImageView *image;


Es ebbe igy lehet betolteni egy kepet file-bol, ha tudjuk hol van:

NSString *filePath = ...;


[[cell image] setImage:[[UIImage alloc] initWithContentsOfFile:filePath]];


Tuesday, August 11, 2009

Hova teszi a Simulator a kepeket es a thumbnaileket

Ide:
/Users/xxx/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE
A thumbnaileket pedig ide ala a /.MISC-be, de ez finder-ben alapbol nem latszik
Itt van egy csomo THM ami valojaban 75x75 pixeles JPG es BTH ami nem tudom micsoda.

Monday, August 10, 2009

Video lejatszasa iPhone-on

MediaPlayer frameworkkel nagyon egyszer.

nehany cikk a UIImagePickerController-rol

dot notation vagy bracket notation

Itt van a teljes cikk az eschatology-n, de a lenyeg:

  • Hasznaljunk @property deklaraciot az object state-jeinel es ezeket dot notation-nel hivjuk.
  • Hasznaljunk method deklaraciot az object behavior-jainal es ezeket bracket notation-nel hivjuk.

Tuesday, July 21, 2009

Friday, July 17, 2009

Hova ment UIImageWriteToSavedPhotosAlbum Simulator-ban

Hat ide:
yourhome/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE

Wednesday, July 15, 2009

Adatatvitel lite versionbol fizetosbe

Itt van egy leiras, hogy a Strip - Password Manager fejlesztoi hogyan oldottak ezt meg.

UIView atmeretezes az IB-ben

Csak akkor lehet atmeretezni UIView-t az Interface Builder-ben a View Size tab-on (Tools/Size Inspector), ha a View Attributes tab-on (View/Attributes Inspector) az osszes Simulated Interface Element ki van kapcsolva. A 3-as SDK-tol a Status Bar default Gray-re van allitva None helyett es amig ezt nem allitjuk at None-ra, addig nem lehet atmeretezni a View-t.

Furcsa, hogy ha mindharom Simulated Interface Element-et kikapcsolom, akkor a Height marad 460 ugyanugy, mitha a Status Bar-t bellitom valamire, de ha mondjuk a Bottom Bar-nak beallitom a Tab Bar-t, akkor 460 frame-rol 431 frame-re ugrik ossze a View. Ez meg ertheto is lenne, ha a TabBar 29 frame magas lenne, de az 49 frame magas.

Az is fura, hogy ha a Bottom Bar-ra bellitom a Toolbar-t vagy Black Toolbar-t, akkor a View magassaga 436 frame lesz, de ha Translucent Black Toolbar-t valasztom akkor a View-t 480 frame magasra allitja be.

Monday, July 13, 2009

Introduction to Property Lists

Property lists organize data into named values and lists of values using several object types...

Learn C es Learn Objective-C

Learn C

Memory Management Programming Guide for Cocoa

You should read this document to learn about the object ownership policies and related techniques for creating, copying, retaining, and disposing of objects in a reference-counted environment.

ketujjas muveletek az iPhone Simulatorban

Option key (alt) - 2 "uj" a kozeppotra tukrozve mozog
Option key + Shift - egyutt mozog a 2 "uj"

Thursday, July 9, 2009

UITableView

A header file-ban meg kell adni, hogy a Controller implementalja a UITableViewDataSource protokolt:

@interface TestViewController: UIViewController <UITableViewDataSource> {}

implementalni pedig a numberOfRowsInSection-t kell ami meghatarozza, hogy hany cella lesz a TableView-ban, illetve a cellForRowAtIndexPath-ot, ami kitolti a cellat.

Ha le akarjuk kezelni a cellara kattintast, akkor a UITableViewDeleagate protokollt is be kell venni az interface-be es ebbol a didSelectRowAtIndexPath-ot kell implementalni.


Loggolas XCode-ban

Ahhoz, hogy lassuk amit logolunk be kell kapcsolni a Debugger Console-t.

NSLog

Logs an error message to the Apple System Log facility.

void NSLog (NSString *format, ... ); 

Discussion

Simply calls NSLogv, passing it a variable number of arguments.

Availability
  • Available in iPhone OS 2.0 and later.

format specifiers:
%@ Object
%d, %i signed int
%u unsigned int
%f float/double

%x, %X hexadecimal int
%o octal int
%zu size_t
%p pointer
%e float/double (in scientific notation)
%g float/double (as %f or %e, depending on value)
%s C string (bytes)
%S C string (unichar)
%.*s Pascal string (requires two arguments, pass pstr[0] as the first, pstr+1 as the second)
%c character
%C unichar

%lld long long
%llu unsigned long long
%Lf long double

XCode: Ugras a header file megfelelo reszere

Ha az implementation-bol akarunk a header file vonatkozo reszere ugrani, akkor a cmd-t nyomva kell duplan kattintani a kivant reszre.

XCode-bol ugras a Documentation-be

Ha ax XCode-ban lenyomva tartjuk az alt gombot, akkor a kurzorbol egy kereszt lesz es ha igy duplan kattintunk valamire, akkor az felhozza a documentation vontakozo reszet.