Monday, December 14, 2009
ullrich: Optimize your Autorelease pools
NSAutoreleaseHighWaterMark
Default: 0
If set to X, autorelease pools will print a message if more than X objects accumulate in the pool
NSAutoreleaseHighWaterResolution
Default: 0
If set to Y, a message is logged for every Y objects that accumulate in the pool beyond the high-water mark (X)
Thursday, December 10, 2009
NSAssert
The NSAssert() function is unreliable, and therefore dangerous. Plain-old assert() is a better choice...
Rob Napier:
Broad use of NSAssert() will not turn ObjC into Eiffel, but it's still a fairly good practice as long as you keep in mind how it's actually implemented and what it's doing. Things to keep in mind about NSAssert():...
But set NS_BLOCK_ASSERTIONS pre compiler flag for release.
Tuesday, December 8, 2009
Kamocsay Lajos: how to debug EXC_BAD_ACCESS on iPhone
If you set the NSZombiEnabled environment variable, the Objective C runtime will leave a dummy object behind for every deallocated object. When the zombie object is called, execution stops and you can see the message that was sent to the object and the call stack that tells you where the message came from (it doesn’t tell you where you over released the object, but knowing where the object is called from should get you pretty close to the problem.)
Friday, December 4, 2009
Monday, November 30, 2009
John Muchow: UIAlertView and Landscape Mode
Show Alerts in Landscape Mode
To fix this, all you need to do is add the following line of code – I placed this in the applicationDidFinishLaunching method:
// Required so UIAlertView shows in the correct orientation in landscape mode
[application setStatusBarOrientation:
UIInterfaceOrientationLandscapeRight animated:NO];
Thursday, November 26, 2009
MPSwipableView, MPFullScreenVideoOverlay
Tuesday, November 24, 2009
MPMoviePlayerController Done button-janak letakarasa.


Friday, November 20, 2009
overlay View az MPMoviePlayerController-en
Wednesday, November 18, 2009
awakeFromNib
Prepares the receiver for service after it has been loaded from an Interface Builder archive, or nib file.
- (void)awakeFromNib
Discussion
The nib-loading infrastructure sends an awakeFromNib
message to each object recreated from a nib archive, but only after all the objects in the archive have been loaded and initialized. When an object receives an awakeFromNib
message, it is guaranteed to have all its outlet and action connections already established.
You must call the super
implementation of awakeFromNib
to give parent classes the opportunity to perform any additional initialization they require. Although the default implementation of this method does nothing, many UIKit classes provide non-empty implementations. You may call the super
implementation at any point during your own awakeFromNib
method.
Note: During Interface Builder’s test mode, this message is also sent to objects instantiated from loaded Interface Builder plug-ins. Because plug-ins link against the framework containing the object definition code, Interface Builder is able to call their awakeFromNib
method when present. The same is not true for custom objects that you create for your Xcode projects. Interface Builder knows only about the defined outlets and actions of those objects; it does not have access to the actual code for them.
During the instantiation process, each object in the archive is unarchived and then initialized with the method befitting its type. Objects that conform to the NSCoding
protocol (including all subclasses of UIView
and UIViewController
) are initialized using their initWithCoder:
method. All objects that do not conform to the NSCoding
protocol are initialized using their init
method. After all objects have been instantiated and initialized, the nib-loading code reestablishes the outlet and action connections for all of those objects. It then calls the awakeFromNib
method of the objects. For more detailed information about the steps followed during the nib-loading process, see Nib Files and Cocoa in Resource Programming Guide.
Important: Because the order in which objects are instantiated from an archive is not guaranteed, your initialization methods should not send messages to other objects in the hierarchy. Messages to other objects can be sent safely from within an awakeFromNib
method.
Typically, you implement awakeFromNib
for objects that require additional set up that cannot be done at design time. For example, you might use this method to customize the default configuration of any controls to match user preferences or the values in other controls. You might also use it to restore individual controls to some previous state of your application.
networkActivityIndicatorVisible
Hogyan merjuk az eltelt idot
#import
uint64_t start = mach_absolute_time();
// do stuff to be timed
uint64_t end = mach_absolute_time();
uint64_t elapsed = end - start;
mach_timebase_info_data_t info;
if (mach_timebase_info (&info) != KERN_SUCCESS) {
printf ("mach_timebase_info failed\n");
}
uint64_t nanosecs = elapsed * info.numer / info.denom;
uint64_t millisecs = nanosecs / 1000000;
Tuesday, November 17, 2009
Status bar eltuntetese
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
Ez viszont onmagaban meg nem eleg, mert a View teteje ugyan felkerul a Status bar helyere, de letakarja egy darab a Root View Controllerbol. Akkor mukodik jol, ha az xx-Info.plist-ben felvesszuk a "Status bar is initally hidden" kulcsot es kipipaljuk. Ezutan persze ahol latni szeretnenk a Status bart, ott kulon meg kell adni a fenti hivassal, hogy NE legyen hidden, de ahol azt adjuk meg, hogy legyen hidden ott tenyleg az lesz.
A masik lehetoseg, ha nem nyulunk az Info.plist-hez, hanem az AppDelegate-ben az applicationDidFinishLaunching-ban allitjuk be YES-re mielott a window-hoz hozzaadnank a Sub View-t. Ezutan akar vissza is allithatjuk NO-ra es csak ott valtoztatunk rajta ahol kell.
A lenyeg, hogy miutan egy Sub View-t mar hozzaadtunk a window-hoz, akkor mar hiaba rejtjuk el a Status Bar-t, ha elotte nem tettuk meg akkor hibas lesz. Ez valami bug lehet, a 3.1.2-ben amit gondolom kesobb majd javitanak.
Wednesday, November 11, 2009
Thumbnail keszitese
Categories
Defining a category is identical to defining the interface for a class, with one small exception: you add a category name inside a set of parenthesis after the interface declaration..."
Categories and Extensions leiras az iPhone OS Reference Libraryban
Monday, November 9, 2009
Sunday, November 8, 2009
How To Get two or more different versions of the same app on your iphone.
1. Right click on the project
2. Select Get Info menu
3. Find Product Name in the right column
4. Change this property as you like. E.g. build20091107
5. Build your app
6. Upload app on the iphone
7. Get the icon with the text build20091107
8. Go ahead and repeat all steps once again but set another build
number in the step 4. E.g. build20091108
9. Get two different apps on your iphone.
Thursday, November 5, 2009
Monday, November 2, 2009
Button (vagy barmi mas) UITableView ala
Thursday, October 29, 2009
Cell Styles
UITableViewCellStyleDefault
A simple style for a cell with a text label (black and left-aligned) and an optional image view. Note that this is the default style for cells prior to iPhone OS 3.0.
Available in iPhone OS 3.0 and later.
Declared in
UITableViewCell.h
.UITableViewCellStyleValue1
A style for a cell with a label on the left side of the cell with left-aligned and black text; on the right side is a label that has smaller blue text and is right-aligned. The Settings application uses cells in this style.
Available in iPhone OS 3.0 and later.
Declared in
UITableViewCell.h
.UITableViewCellStyleValue2
A style for a cell with a label on the left side of the cell with text that is right-aligned and blue; on the right side of the cell is another label with smaller text that is left-aligned and black. The Phone/Contacts application uses cells in this style.
Available in iPhone OS 3.0 and later.
Declared in
UITableViewCell.h
.UITableViewCellStyleSubtitle
A style for a cell with a left-aligned label across the top and a left-aligned label below it in smaller gray text. The iPod application uses cells in this style.
Available in iPhone OS 3.0 and later.
Declared in
UITableViewCell.h
.
Discussion
In all these cell styles, the larger of the text labels is accessed via the textLabel
property and the smaller via the detailTextLabel
property.
App Version
Thursday, October 15, 2009
SubString keresese NSString-ben
Monday, October 12, 2009
Honnan lehet tudni, hogy Simulator-ban fut-e az app
It's in the SDK docs under "Compiling source code conditionally"
The relevant definitions are TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR, which will be defined provided that you
#include "TargetConditionals.h"
Since that won't exist on non apple platforms, you can wrap your include like this
#ifdef __APPLE__
#include "TargetConditionals.h"
#endif
before including that file
So, for example, if you want to check that you are running on device, you should do
#if !(TARGET_IPHONE_SIMULATOR)
Thursday, October 8, 2009
GUID generalasa iPhone-on
+ (NSString *)GetUUID
{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
return [(NSString *)string autorelease];
}
Monday, October 5, 2009
Friday, October 2, 2009
Fast Enumeration
Tuesday, September 22, 2009
Fenyes gombok keszitese
Tuesday, September 15, 2009
Andy Finnell: Don’t lose your keys
Andy Finnell: [UIImage imageNamed:] is a memory leak
Monday, September 7, 2009
Core Data save hiba es NSError Array (1560) kiiratasa
UIImage betoltese bundle-bol
[UIImage imageWithContentsOfFile:
[[NSBundle mainBundle]
pathForResource:@"thefilename"
ofType:@"jpg"]];
Glyphysh - 120 icons for iPhone applications
UIImage trukkok
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];
- 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
[self.tableView insertRowsAtIndexPaths:myObject withRowAnimation:UITableViewRowAnimationFade];
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
Wednesday, September 2, 2009
Saturday, August 29, 2009
UIActivityIndicatorView
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
Monday, August 24, 2009
Kepek leszedese iPhone-rol
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
- 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
Wednesday, August 12, 2009
thumbnail betoltese UITableViewCell-be
IBOutlet UIImageView *image;
...
@property (nonatomic, retain) IBOutlet UIImageView *image;
NSString *filePath = ...;
[[cell image] setImage:[[UIImage alloc] initWithContentsOfFile:filePath]];