Тег ‘xCode’:

Tutorial: Drag and Drop file on NSImageView

Step by step for starter developers…
1. Create a project in xCode with name “DragAndDrop” or any else…2. Add an element “NSImageView” on main view in the MainMenu.xib

Теги: , , , , , , ,

Комментарии отсутствуют

convert iPhone xib to iPad/iPhone xib

Теги: , , , , , , ,

Комментарии отсутствуют

Does a NSString contain a substring ?

Here is a little tip on how to tell if a string contains another string, using the underused data type NSRange.
NSRange gives the starting location and the length of a given value, and is often used with arrays and strings. On this occasion we will use it to find the range of a substring within [...]

Теги: , , , , , ,

Комментарии отсутствуют

call controller methods from class

I created a class (Foo.m) which I would like to be able to call a method in the controller (MainViewController.m) which instantiated it. How do I do this?
One way you can do this is to create a property in your Foo class that references its creator. You should not retain this reference to avoid circular [...]

Теги: , ,

Комментарии отсутствуют

Hello Music Player

Here is a bare bones hello world-style example that demonstrates library access and music playback. In a few minutes you can have a working, if minimal, music player. Lacking a user interface, this code queues up the entire iPod library and starts playing immediately on launch.
Note: To follow these steps you’ll need a provisioned device [...]

Теги: , , , ,

Комментарии отсутствуют

Resize and Mask an Image

Make image with a mask!

Source:
- (UIImage*) maskImage:(UIImage *)image  {
   
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
   
    UIImage *maskImage = [UIImage imageNamed:@"mask.png"];
    CGImageRef maskImageRef = [maskImage CGImage];
   
    // create a bitmap graphics context the size of the image
    CGContextRef mainViewContentContext = CGBitmapContextCreate (NULL, maskImage.size.width, maskImage.size.height, 8, 0, [...]

Теги: , , , , , , , ,

Комментарии отсутствуют

RegexKitLite – Lightweight Objective-C Regular Expressions for Mac OS X and iPhone

Very simple installation and in usage.
Installation in iPhone project:
1. Add files RegexKitLite.h and RegexKitLite.m to project.
2. Open Target of project and add -licucore in Other Linker Flags

3. Compile
Example:
Remove tags from web-page.
NSString *text =  [content stringByReplacingOccurrencesOfRegex:@"<.*>" withString:@""];

Site resource

Теги: , , ,

Комментарии отсутствуют

Custom UIActivityIndicatorView

Little modified UIActivityIndicatorView with the ability to display activity indicator before the download data.
UIDownloadActivityIndicator.h
@class UIProgressView;
@protocol UIDownloadActivityIndicatorDelegate;
 
@interface UIDownloadActivityIndicator : UIActivityIndicatorView {
    NSURLRequest* DownloadRequest;
    NSURLConnection* DownloadConnection;
    NSMutableData* receivedData;
    NSString* localFilename;
    id<uidownloadactivityindicatordelegate> delegate;
    long long bytesReceived;
    long long expectedBytes;
   
    float percentComplete;
}
 
- (UIDownloadActivityIndicator *)initWithURL:(NSURL *)fileURL withActivityIndicatorStyle:(UIActivityIndicatorViewStyle)style timeout:(NSInteger)timeout delegate:(id</uidownloadactivityindicatordelegate><uidownloadactivityindicatordelegate>)theDelegate;
- (void) [...]

Теги: , , , ,

Комментариев (2)

iPhone Particles samples OpenGL ES

This is just one possible configuration – one of the simpler ones, actually, as it is only using point rendering and simple gravity – no textures, no wind, no transparency, etc. I call this configuration “fountain”, and it’s can be created in one line of code:
ParticleEmitter3D *fountain = [ParticleEmitter3D fountain];
then, you just need to tell [...]

Теги: , , ,

Комментариев (2)

Setup Python, MySQL, MySQL-python and SVN on MAC OS X 10.6

Mac Os X + Python 2.6.1+ PIL + apache2.2 +mod_python + MySQL + MySQLdb +php5+ phpMyAdmin + SVN server +WebSVN
OS: Mac OS X 10.6.1 Snow Leopard
XCode:The latest Xcode Tools
Python: Python 2.6.1 64-bit (Snow Leopard default)
Projects will be located in ~/Sites, so change permissions:
add read permission for everyone on ~/Sites
Setup django
[...]

Теги: , , , , ,

Комментарии отсутствуют