Skip to content

Commit

Permalink
Optimization algorithm
Browse files Browse the repository at this point in the history
add new method for easy to use
  • Loading branch information
qdvictory committed May 12, 2012
1 parent da743b3 commit ca0390a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Binary file not shown.
16 changes: 12 additions & 4 deletions MIImageDemoForMac/AppDelegate.m
Expand Up @@ -22,12 +22,20 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{ {
// Insert code here to initialize your application // Insert code here to initialize your application


MIImage *mimage = [[MIImage alloc] initWithNamed:@"test.png" secret:@"123"]; //get image with name
NSImageView *imageview = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 400,400)]; NSImageView *imageview = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 320, 480)];
imageview.image = [mimage image]; imageview.image = [MIImage imageWithNamed:@"test.png" secret:@"123"];
[mimage release];
[[self.window contentView] addSubview:imageview]; [[self.window contentView] addSubview:imageview];
[imageview release]; [imageview release];

//or

// //get image with path
// NSImageView *imageview = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 320, 480)];
// imageview.image = [MIImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"test.png" ofType:nil] secret:@"123"];
// [[self.window contentView] addSubview:imageview];
// [imageview release];

} }


@end @end
7 changes: 3 additions & 4 deletions MIImageDemoForMac/MIImage.h
Expand Up @@ -10,9 +10,8 @@


@interface MIImage : NSObject @interface MIImage : NSObject
{ {

} }
- (id)initWithNamed:(NSString *)_str secret:(NSString *)_sec; + (NSImage *)imageWithNamed:(NSString *)_str secret:(NSString *)_sec;
- (id)initWithPath:(NSString *)_str secret:(NSString *)_sec; + (NSImage *)imageWithPath:(NSString *)_str secret:(NSString *)_sec;
@property (retain,nonatomic) NSImage *image;
@end @end
Binary file modified MIImageDemoForMac/libMIDataForMac.a
Binary file not shown.

0 comments on commit ca0390a

Please sign in to comment.