(created) |
m (→Utility Apps) |
||
(5 intermediate revisions by one other user not shown) | |||
Line 17: | Line 17: | ||
== Application Styles == | == Application Styles == | ||
Apples Human Interface Guidlines beschreiben drei | Apples Human Interface Guidlines beschreiben drei mögliche Stile für Applikationen: | ||
* [http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/MobileHIG/DevelopingSoftware/DevelopingSoftware.html#//apple_ref/doc/uid/TP40006556-CH5-SW28 Apple iPhone HIG: Three Application Styles] | * [http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/MobileHIG/DevelopingSoftware/DevelopingSoftware.html#//apple_ref/doc/uid/TP40006556-CH5-SW28 Apple iPhone HIG: Three Application Styles] | ||
Line 32: | Line 32: | ||
* neater Design (eg. custom TableRows) | * neater Design (eg. custom TableRows) | ||
* nevertheless very consistent with HIG | * nevertheless very consistent with HIG | ||
* eg. Weather | * eg. [[Weather]] | ||
=== Immersive Apps === | === Immersive Apps === | ||
Line 38: | Line 38: | ||
* low inforcement of Apple's HIG | * low inforcement of Apple's HIG | ||
* eg. Racing Game | * eg. Racing Game | ||
== Drawing Methods == | == Drawing Methods == | ||
Line 48: | Line 46: | ||
=== UIViews === | === UIViews === | ||
* Gewöhnliche Komponenten, die in Interface Builder arrangiert werden | * Gewöhnliche Komponenten, die in Interface Builder arrangiert werden | ||
* z.B. UITableView, UIButtons, UITextField, UISlider, UIPickerView ... | * z.B. UITableView, UIWebView, UIButtons, UITextField, UISlider, UIPickerView ... | ||
Beispiel (UITableView subclass): | |||
<source lang="objc"> | <source lang="objc"> | ||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||
// | // In order to show a new view, we'll create a new view controller instance | ||
RecipeDetailViewController *detailViewController = [[RecipeDetailViewController alloc] initWithStyle:UITableViewStyleGrouped]; | // and push it onto the views stack of the Navigation Controller | ||
RecipeDetailViewController *detailViewController = | |||
[[RecipeDetailViewController alloc] initWithStyle:UITableViewStyleGrouped]; | |||
[self.navigationController pushViewController:detailViewController animated:animated]; | [self.navigationController pushViewController:detailViewController animated:animated]; | ||
[detailViewController release]; | [detailViewController release]; | ||
Line 62: | Line 62: | ||
<br/> | <br/> | ||
=== Quartz 2D === | === Quartz 2D === | ||
* Einfaches, zweidimensionales Zeichnen | * Einfaches, zweidimensionales Zeichnen | ||
Line 67: | Line 68: | ||
* [http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/index.html iPhone Dev Center: Quartz 2D Programming Guide] | * [http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/index.html iPhone Dev Center: Quartz 2D Programming Guide] | ||
Beispiel: | Beispiel (UIView sublcass): | ||
<source lang="objc"> | <source lang="objc"> | ||
- (void)drawRect:(NSRect)rect | - (void)drawRect:(NSRect)rect { | ||
{ | CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort]; | ||
CGContextRef myContext = [[NSGraphicsContext | |||
// ********** Your drawing code here ********** | // ********** Your drawing code here ********** | ||
CGContextSetRGBFillColor (myContext, 1, 0, 0, 1); | CGContextSetRGBFillColor (myContext, 1, 0, 0, 1); | ||
Line 85: | Line 83: | ||
<br/> | <br/> | ||
=== Open GL === | === Open GL === | ||
* Komplexes, dreidimensionale Strukturen | * Komplexes, dreidimensionale Strukturen | ||
Line 90: | Line 89: | ||
* [http://developer.apple.com/iphone/library/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Introduction/Introduction.html iPhone Dev Center: OpenGL ES Programming Guide] | * [http://developer.apple.com/iphone/library/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Introduction/Introduction.html iPhone Dev Center: OpenGL ES Programming Guide] | ||
Beispiel: | Beispiel (UIView subclass w. custom timer): | ||
<source lang="objc"> | <source lang="objc"> | ||
- (void) render { | - (void) render { | ||
Line 118: | Line 116: | ||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer); | glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer); | ||
[context presentRenderbuffer:GL_RENDERBUFFER_OES]; | [context presentRenderbuffer:GL_RENDERBUFFER_OES]; | ||
} | |||
-(void)applicationDidFinishLaunching:(UIApplication*)application { | |||
// (...) | |||
animationTimer = [NSTimer scheduledTimerWithTimeInterval:(NSTimeInterval)((1.0 / 60.0) * animationFrameInterval) | |||
target:self | |||
selector:@selector(render) | |||
userInfo:nil | |||
repeats:TRUE]; | |||
} | } | ||
</source> | </source> |
Latest revision as of 14:37, 26 May 2010
Application Types
Native iPhone Applications:
- based on Cocoa Touch
- written in Objective-C
iPhone Web-based Apps:
- Website optimized for iPhone
- written in HTML, CSS, JavaScript(, PHP)
- usable as App via "WebClip"
Hybrid Applications:
- mixed Cocoa Touch & Web App
Application Styles
Apples Human Interface Guidlines beschreiben drei mögliche Stile für Applikationen:
Productivity Apps
- Hierarchical Info
- Usually UITableView
- extremely consistent with HIG
- eg. Mail
Utility Apps
- Specific info with as little interaction as possible
- Usually using the small "i" to flip views
- neater Design (eg. custom TableRows)
- nevertheless very consistent with HIG
- eg. Weather
Immersive Apps
- Custom Interface
- low inforcement of Apple's HIG
- eg. Racing Game
Drawing Methods
Es gibt drei gundsätzlich verschiedene Methoden, um den "Anzeige-Part" in einer iPhone App darzustellen.
UIViews
- Gewöhnliche Komponenten, die in Interface Builder arrangiert werden
- z.B. UITableView, UIWebView, UIButtons, UITextField, UISlider, UIPickerView ...
Beispiel (UITableView subclass):
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// In order to show a new view, we'll create a new view controller instance
// and push it onto the views stack of the Navigation Controller
RecipeDetailViewController *detailViewController =
[[RecipeDetailViewController alloc] initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:detailViewController animated:animated];
[detailViewController release];
}
Quartz 2D
- Einfaches, zweidimensionales Zeichnen
- Painting-on-Canvas Methode: übereinanderlagern durch Position im Quellcode
- iPhone Dev Center: Quartz 2D Programming Guide
Beispiel (UIView sublcass):
- (void)drawRect:(NSRect)rect {
CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];
// ********** Your drawing code here **********
CGContextSetRGBFillColor (myContext, 1, 0, 0, 1);
CGContextFillRect (myContext, CGRectMake (0, 0, 200, 100 ));
CGContextSetRGBFillColor (myContext, 0, 0, 1, .5);
CGContextFillRect (myContext, CGRectMake (0, 0, 100, 200));
}
Open GL
- Komplexes, dreidimensionale Strukturen
- Standartisierte OpenGL Sprache (Subset für iPhone)
- iPhone Dev Center: OpenGL ES Programming Guide
Beispiel (UIView subclass w. custom timer):
- (void) render {
[EAGLContext setCurrentContext:context];
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glViewport(0, 0, backingWidth, backingHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, (GLfloat)(sinf(transY)/2.0f), 0.0f);
transY += 0.075f;
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
}
-(void)applicationDidFinishLaunching:(UIApplication*)application {
// (...)
animationTimer = [NSTimer scheduledTimerWithTimeInterval:(NSTimeInterval)((1.0 / 60.0) * animationFrameInterval)
target:self
selector:@selector(render)
userInfo:nil
repeats:TRUE];
}
Diese Seite ist Teil des Werkmoduls iOS Development von Michael Markert für Interface Design / Fakultät Medien an der Bauhaus-Universität Weimar.