diff --git a/Pegasus/PGAdapter.h b/Pegasus/PGAdapter.h index 1d0ed9d..1049c19 100644 --- a/Pegasus/PGAdapter.h +++ b/Pegasus/PGAdapter.h @@ -19,6 +19,8 @@ #import +@class PGView; + @protocol PGAdapter + (NSString *)name; @@ -27,5 +29,6 @@ @optional - (void)setValue:(NSString *)string forVirtualProperty:(NSString *)propertyName; +- (void)addSubview:(PGView *)subview; @end \ No newline at end of file diff --git a/Pegasus/PGTableView.h b/Pegasus/PGTableView.h new file mode 100644 index 0000000..2da286d --- /dev/null +++ b/Pegasus/PGTableView.h @@ -0,0 +1,26 @@ +// +// PGTableView.h +// Pegasus +// +// Copyright 2012 Jonathan Ellis +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "PGView.h" + +@interface PGTableView : PGView { + NSMutableArray *cells; +} + +@end diff --git a/Pegasus/PGTableView.m b/Pegasus/PGTableView.m new file mode 100644 index 0000000..b7a1378 --- /dev/null +++ b/Pegasus/PGTableView.m @@ -0,0 +1,80 @@ +// +// PGTableView.m +// Pegasus +// +// Copyright 2012 Jonathan Ellis +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "PGTableView.h" + +@implementation PGTableView + ++ (NSString *)name { + return @"tableview"; +} + ++ (NSDictionary *)properties { + + NSMutableDictionary *properties =[NSMutableDictionary dictionaryWithObjectsAndKeys: + @"float", @"rowHeight", + @"UITableViewCellSeparatorStyle", @"separatorStyle", + @"UITextAlignment", @"textAlignment", + @"UIColor", @"separatorColor", + // @"UIView", @"backgroundView", + // @"UIView", @"tableHeaderView", + // @"UIView", @"tableFooterView", + @"float", @"sectionHeaderHeight", + @"float", @"sectionFooterHeight", + @"int", @"sectionIndexMinimumDisplayRowCount", + @"BOOL", @"allowsSelection", + @"BOOL", @"allowsMultipleSelection", + @"BOOL", @"allowsSelectionDuringEditing", + @"BOOL", @"allowsMultipleSelectionDuringEditing", + @"BOOL", @"editing", + nil]; + + [properties addEntriesFromDictionary:[PGView properties]]; + + return properties; +} + ++ (Class)underlyingClass { + return [UITableView class]; +} + +- (void)addSubview:(PGView *)subview { + if ([subview isKindOfClass:[PGTableViewCell class]]) { + if (!cells) { + cells = [NSMutableArray array]; + UITableView *tableView = (UITableView *)view; + tableView.dataSource = self; + } + [cells addObject:subview.view]; + } else { + [super addSubview:subview]; + } +} + +#pragma mark - UITableViewDataSource methods + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + return [cells objectAtIndex:indexPath.row]; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [cells count]; +} + +@end diff --git a/Pegasus/PGTableViewCell.h b/Pegasus/PGTableViewCell.h new file mode 100644 index 0000000..c38088d --- /dev/null +++ b/Pegasus/PGTableViewCell.h @@ -0,0 +1,24 @@ +// +// PGTableViewCell.h +// Pegasus +// +// Copyright 2012 Jonathan Ellis +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "PGView.h" + +@interface PGTableViewCell : PGView + +@end diff --git a/Pegasus/PGTableViewCell.m b/Pegasus/PGTableViewCell.m new file mode 100644 index 0000000..3dda913 --- /dev/null +++ b/Pegasus/PGTableViewCell.m @@ -0,0 +1,67 @@ +// +// PGTableViewCell.m +// Pegasus +// +// Copyright 2012 Jonathan Ellis +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "PGTableViewCell.h" + +@implementation PGTableViewCell + ++ (NSString *)name { + return @"tableviewcell"; +} + ++ (NSDictionary *)properties { + + NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithObjectsAndKeys: + @"#", @"text", + @"#", @"text-font", + // @"#", @"detail-text", + @"#", @"image", + @"BOOL", @"editing", + @"BOOL", @"showsReorderControl", + @"int", @"indentationLevel", + @"float", @"indentationWidth", + nil]; + + [properties addEntriesFromDictionary:[PGView properties]]; + + return properties; +} + ++ (Class)underlyingClass { + return [UITableViewCell class]; +} + +- (void)setValue:(NSString *)string forVirtualProperty:(NSString *)property { + [super setValue:string forVirtualProperty:property]; + + UITableViewCell *tableViewCell = (UITableViewCell *)view; + + if ([property isEqualToString:@"text"]) { + tableViewCell.textLabel.text = string; + } else if ([property isEqualToString:@"text-font"]) { + tableViewCell.textLabel.font = [PGTranslators fontWithString:string]; + } else if ([property isEqualToString:@"detail-text"]) { + tableViewCell.detailTextLabel.text = string; + } else if ([property isEqualToString:@"image"]) { + tableViewCell.imageView.image = [PGTranslators imageWithString:string]; + } + +} + +@end \ No newline at end of file diff --git a/Pegasus/PGTranslators.h b/Pegasus/PGTranslators.h index c697987..b54116c 100644 --- a/Pegasus/PGTranslators.h +++ b/Pegasus/PGTranslators.h @@ -23,6 +23,36 @@ + (SEL)translatorForType:(NSString *)type; +#pragma mark - Translators (Primitives) ++ (int)intWithString:(NSString *)string; ++ (double)doubleWithString:(NSString *)string; ++ (float)floatWithString:(NSString *)string; ++ (BOOL)boolWithString:(NSString *)string; + +#pragma mark - Translators (Structs) ++ (CGRect)rectWithString:(NSString *)string; ++ (CGSize)sizeWithString:(NSString *)string; ++ (CGPoint)pointWithString:(NSString *)string; ++ (CGAffineTransform)affineTransformWithString:(NSString *)string; ++ (UIEdgeInsets)edgeInsetsWithString:(NSString *)string; + +#pragma mark - Translators (Enums) ++ (UITextAlignment)textAlignmentWithString:(NSString *)string; ++ (UITextBorderStyle)textBorderStyleWithString:(NSString *)string; ++ (UIViewAutoresizing)autoresizingWithString:(NSString *)string; ++ (UIViewContentMode)contentModeWithString:(NSString *)string; ++ (UILineBreakMode)lineBreakModeWithString:(NSString *)string; ++ (UITextFieldViewMode)textFieldViewModeFromString:(NSString *)string; ++ (UIScrollViewIndicatorStyle)scrollViewIndicatorStyleWithString:(NSString *)string; ++ (UIProgressViewStyle)progressViewStyleWithString:(NSString *)string; ++ (UITableViewCellSeparatorStyle)tableViewCellSeparatorStyleWithString:(NSString *)string; + +#pragma mark - Translators (Objects) ++ (NSString *)stringWithString:(NSString *)string; ++ (UIColor *)colorWithString:(NSString *)string; ++ (UIImage *)imageWithString:(NSString *)string; ++ (UIFont *)fontWithString:(NSString *)string; + + (NSArray *)componentsForTuple:(NSString *)string; @end diff --git a/Pegasus/PGTranslators.m b/Pegasus/PGTranslators.m index 2087c0b..9d81758 100644 --- a/Pegasus/PGTranslators.m +++ b/Pegasus/PGTranslators.m @@ -44,6 +44,7 @@ + (SEL)translatorForType:(NSString *)type { if ([type isEqualToString:@"UITextFieldViewMode"]) return @selector(textFieldViewModeWithString:); if ([type isEqualToString:@"UIScrollViewIndicatorStyle"]) return @selector(scrollViewIndicatorStyleWithString:); if ([type isEqualToString:@"UIProgressViewStyle"]) return @selector(progressViewStyleWithString:); + if ([type isEqualToString:@"UITableViewCellSeparatorStyle"]) return @selector(tableViewCellSeparatorStyleWithString:); // Objects: if ([type isEqualToString:@"NSString"]) return @selector(stringWithString:); @@ -181,6 +182,13 @@ + (UIProgressViewStyle)progressViewStyleWithString:(NSString *)string { return 0; } ++ (UITableViewCellSeparatorStyle)tableViewCellSeparatorStyleWithString:(NSString *)string { + if ([string isEqualToString:@"none"]) return UITableViewCellSeparatorStyleNone; + if ([string isEqualToString:@"single-line"]) return UITableViewCellSeparatorStyleSingleLine; + if ([string isEqualToString:@"single-line-etched"]) return UITableViewCellSeparatorStyleSingleLineEtched; + return 0; +} + #pragma mark - Translators (Objects) + (NSString *)stringWithString:(NSString *)string { diff --git a/Pegasus/Pegasus.h b/Pegasus/Pegasus.h index 5365f46..6e88a29 100644 --- a/Pegasus/Pegasus.h +++ b/Pegasus/Pegasus.h @@ -39,6 +39,10 @@ #import "PGTextField.h" #import "PGButton.h" #import "PGScrollView.h" +#import "PGProgressView.h" +#import "PGSwitch.h" +#import "PGTableView.h" +#import "PGTableViewCell.h" // Layouts #import "PGLayout.h" diff --git a/Pegasus/Views/PGView.m b/Pegasus/Views/PGView.m index b5a9717..5ba589d 100644 --- a/Pegasus/Views/PGView.m +++ b/Pegasus/Views/PGView.m @@ -40,7 +40,7 @@ + (PGView *)viewWithData:(NSData *)data { PGView *view = [PGView viewWithElement:rootElement]; if (view) return view; - NSLog(@"Pegasus Error: No corresponding class for root tag '%@'. Ignoring and returning nil!", rootElement.name); + NSLog(@"Pegasus Error: No corresponding class for root element '%@'. Ignoring and returning nil!", rootElement.name); return nil; } @@ -55,6 +55,8 @@ + (PGView *)viewWithElement:(CXMLElement *)element { @"PGButton", @"PGSwitch", @"PGProgressView", + @"PGTableView", + @"PGTableViewCell", nil]; // Search for class matching the tag name @@ -112,10 +114,9 @@ - (id)initWithElement:(CXMLElement *)element { PGView *subview = [PGView viewWithElement:childElement]; if (subview) { - [layout addView:subview.view]; - [subviews addObject:subview]; + [self addSubview:subview]; } else { - NSLog(@"Pegasus Error: No corresponding class for tag '%@'. Ignoring!", childElement.name); + NSLog(@"Pegasus Error: No corresponding class for element '%@'. Ignoring!", childElement.name); } } @@ -230,5 +231,10 @@ - (void)setValue:(NSString *)string forVirtualProperty:(NSString *)propertyName } } +- (void)addSubview:(PGView *)subview { + [layout addView:subview.view]; + [subviews addObject:subview]; +} + @end \ No newline at end of file diff --git a/Sample/PegasusSample.xcodeproj/project.pbxproj b/Sample/PegasusSample.xcodeproj/project.pbxproj index b041f52..70873ab 100644 --- a/Sample/PegasusSample.xcodeproj/project.pbxproj +++ b/Sample/PegasusSample.xcodeproj/project.pbxproj @@ -7,6 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 8400EF6314FE4BF1001064F5 /* sample4.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8400EF6114FE4BF0001064F5 /* sample4.xml */; }; + 8400EF6414FE4BF1001064F5 /* sample5.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8400EF6214FE4BF0001064F5 /* sample5.xml */; }; + 8400EF6714FE4C76001064F5 /* PGTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8400EF6614FE4C76001064F5 /* PGTableView.m */; }; + 8400EF6A14FE4E77001064F5 /* PGTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8400EF6914FE4E77001064F5 /* PGTableViewCell.m */; }; + 841DDE5F14FFB4950090D810 /* alpha.png in Resources */ = {isa = PBXBuildFile; fileRef = 841DDE5B14FFB4950090D810 /* alpha.png */; }; + 841DDE6014FFB4950090D810 /* beta.png in Resources */ = {isa = PBXBuildFile; fileRef = 841DDE5C14FFB4950090D810 /* beta.png */; }; + 841DDE6114FFB4950090D810 /* delta.png in Resources */ = {isa = PBXBuildFile; fileRef = 841DDE5D14FFB4950090D810 /* delta.png */; }; + 841DDE6214FFB4950090D810 /* gamma.png in Resources */ = {isa = PBXBuildFile; fileRef = 841DDE5E14FFB4950090D810 /* gamma.png */; }; 84542DD014EAB62C0085FFFA /* sample1.xml in Resources */ = {isa = PBXBuildFile; fileRef = 84542DCE14EAB62C0085FFFA /* sample1.xml */; }; 84542DD114EAB62C0085FFFA /* sample2.xml in Resources */ = {isa = PBXBuildFile; fileRef = 84542DCF14EAB62C0085FFFA /* sample2.xml */; }; 8459711C14EA763F001D985D /* NSObject+Invocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 845970E714EA763F001D985D /* NSObject+Invocation.m */; }; @@ -38,7 +46,6 @@ 84C70D9C14F28A810051C13D /* PGLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C70D9914F28A810051C13D /* PGLayout.m */; }; 84C70D9D14F28A810051C13D /* PGLinearLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C70D9B14F28A810051C13D /* PGLinearLayout.m */; }; 84C70DA414F297860051C13D /* PGGridLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C70DA314F297860051C13D /* PGGridLayout.m */; }; - 84C70DA714F299DD0051C13D /* sample4.xml in Resources */ = {isa = PBXBuildFile; fileRef = 84C70DA614F299DD0051C13D /* sample4.xml */; }; 84CA00D514F6466E00ABBE31 /* PGCenterLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CA00D414F6466E00ABBE31 /* PGCenterLayout.m */; }; FC1E563414F1B1FF007D9C1B /* PGButton.m in Sources */ = {isa = PBXBuildFile; fileRef = FC1E562714F1B1FF007D9C1B /* PGButton.m */; }; FC1E563514F1B1FF007D9C1B /* PGImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = FC1E562914F1B1FF007D9C1B /* PGImageView.m */; }; @@ -52,6 +59,16 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 8400EF6114FE4BF0001064F5 /* sample4.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = sample4.xml; path = UI/sample4.xml; sourceTree = ""; }; + 8400EF6214FE4BF0001064F5 /* sample5.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = sample5.xml; path = UI/sample5.xml; sourceTree = ""; }; + 8400EF6514FE4C76001064F5 /* PGTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PGTableView.h; sourceTree = ""; }; + 8400EF6614FE4C76001064F5 /* PGTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGTableView.m; sourceTree = ""; }; + 8400EF6814FE4E77001064F5 /* PGTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PGTableViewCell.h; sourceTree = ""; }; + 8400EF6914FE4E77001064F5 /* PGTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGTableViewCell.m; sourceTree = ""; }; + 841DDE5B14FFB4950090D810 /* alpha.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = alpha.png; path = UI/Images/alpha.png; sourceTree = ""; }; + 841DDE5C14FFB4950090D810 /* beta.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = beta.png; path = UI/Images/beta.png; sourceTree = ""; }; + 841DDE5D14FFB4950090D810 /* delta.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = delta.png; path = UI/Images/delta.png; sourceTree = ""; }; + 841DDE5E14FFB4950090D810 /* gamma.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = gamma.png; path = UI/Images/gamma.png; sourceTree = ""; }; 84542DCE14EAB62C0085FFFA /* sample1.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = sample1.xml; path = UI/sample1.xml; sourceTree = ""; }; 84542DCF14EAB62C0085FFFA /* sample2.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = sample2.xml; path = UI/sample2.xml; sourceTree = ""; }; 845970E614EA763F001D985D /* NSObject+Invocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Invocation.h"; sourceTree = ""; }; @@ -110,7 +127,6 @@ 84C70D9B14F28A810051C13D /* PGLinearLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PGLinearLayout.m; path = Layouts/PGLinearLayout.m; sourceTree = ""; }; 84C70DA214F297860051C13D /* PGGridLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PGGridLayout.h; path = Layouts/PGGridLayout.h; sourceTree = ""; }; 84C70DA314F297860051C13D /* PGGridLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PGGridLayout.m; path = Layouts/PGGridLayout.m; sourceTree = ""; }; - 84C70DA614F299DD0051C13D /* sample4.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sample4.xml; sourceTree = ""; }; 84CA00D314F6466D00ABBE31 /* PGCenterLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PGCenterLayout.h; sourceTree = ""; }; 84CA00D414F6466E00ABBE31 /* PGCenterLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGCenterLayout.m; sourceTree = ""; }; FC1E562614F1B1FF007D9C1B /* PGButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PGButton.h; path = Views/PGButton.h; sourceTree = ""; }; @@ -274,7 +290,8 @@ 84542DCE14EAB62C0085FFFA /* sample1.xml */, 84542DCF14EAB62C0085FFFA /* sample2.xml */, FC1E564514F1BEE0007D9C1B /* sample3.xml */, - 84C70DA614F299DD0051C13D /* sample4.xml */, + 8400EF6114FE4BF0001064F5 /* sample4.xml */, + 8400EF6214FE4BF0001064F5 /* sample5.xml */, ); name = UI; sourceTree = ""; @@ -282,6 +299,10 @@ 84786DD114EAC19300FA6043 /* Images */ = { isa = PBXGroup; children = ( + 841DDE5B14FFB4950090D810 /* alpha.png */, + 841DDE5C14FFB4950090D810 /* beta.png */, + 841DDE5D14FFB4950090D810 /* delta.png */, + 841DDE5E14FFB4950090D810 /* gamma.png */, 84786DD214EAC19E00FA6043 /* dinosaur.png */, 84786DD314EAC19E00FA6043 /* gameboy.png */, 84786DD414EAC19E00FA6043 /* soldier.png */, @@ -308,6 +329,10 @@ FC1E563114F1B1FF007D9C1B /* PGSwitch.m */, FC1E563214F1B1FF007D9C1B /* PGTextField.h */, FC1E563314F1B1FF007D9C1B /* PGTextField.m */, + 8400EF6514FE4C76001064F5 /* PGTableView.h */, + 8400EF6614FE4C76001064F5 /* PGTableView.m */, + 8400EF6814FE4E77001064F5 /* PGTableViewCell.h */, + 8400EF6914FE4E77001064F5 /* PGTableViewCell.m */, ); name = Views; sourceTree = ""; @@ -384,7 +409,12 @@ 84786DD614EAC19E00FA6043 /* gameboy.png in Resources */, 84786DD714EAC19E00FA6043 /* soldier.png in Resources */, FC1E564614F1BEE0007D9C1B /* sample3.xml in Resources */, - 84C70DA714F299DD0051C13D /* sample4.xml in Resources */, + 8400EF6314FE4BF1001064F5 /* sample4.xml in Resources */, + 8400EF6414FE4BF1001064F5 /* sample5.xml in Resources */, + 841DDE5F14FFB4950090D810 /* alpha.png in Resources */, + 841DDE6014FFB4950090D810 /* beta.png in Resources */, + 841DDE6114FFB4950090D810 /* delta.png in Resources */, + 841DDE6214FFB4950090D810 /* gamma.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -426,6 +456,8 @@ 84C70D9D14F28A810051C13D /* PGLinearLayout.m in Sources */, 84C70DA414F297860051C13D /* PGGridLayout.m in Sources */, 84CA00D514F6466E00ABBE31 /* PGCenterLayout.m in Sources */, + 8400EF6714FE4C76001064F5 /* PGTableView.m in Sources */, + 8400EF6A14FE4E77001064F5 /* PGTableViewCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Sample/PegasusSample/PGViewController.h b/Sample/PegasusSample/PGViewController.h index 2a4156a..8c7d25a 100644 --- a/Sample/PegasusSample/PGViewController.h +++ b/Sample/PegasusSample/PGViewController.h @@ -19,6 +19,8 @@ #import -@interface PGViewController : UIViewController +@interface PGViewController : UIViewController { + PGView *pegasusView; +} @end diff --git a/Sample/PegasusSample/PGViewController.m b/Sample/PegasusSample/PGViewController.m index d3edfd6..ec89d74 100644 --- a/Sample/PegasusSample/PGViewController.m +++ b/Sample/PegasusSample/PGViewController.m @@ -33,12 +33,11 @@ - (void)viewDidLoad { [super viewDidLoad]; - - int sample = 1; // *** change this to 2, 3 or 4 for other samples *** + int sample = 1; // *** change this to 2/3/4/5 for other samples *** // Here, we load the XML file (from the UI group): NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"sample%d.xml", sample]]; - PGView *pegasusView = [PGView viewWithContentsOfFile:filePath]; + pegasusView = [PGView viewWithContentsOfFile:filePath]; [self.view addSubview:pegasusView.view]; // pegasusView.view is the actual underlying UIView view diff --git a/Sample/PegasusSample/UI/Images/alpha.png b/Sample/PegasusSample/UI/Images/alpha.png new file mode 100644 index 0000000..fc4fea2 Binary files /dev/null and b/Sample/PegasusSample/UI/Images/alpha.png differ diff --git a/Sample/PegasusSample/UI/Images/beta.png b/Sample/PegasusSample/UI/Images/beta.png new file mode 100644 index 0000000..f5688b1 Binary files /dev/null and b/Sample/PegasusSample/UI/Images/beta.png differ diff --git a/Sample/PegasusSample/UI/Images/delta.png b/Sample/PegasusSample/UI/Images/delta.png new file mode 100644 index 0000000..46f4586 Binary files /dev/null and b/Sample/PegasusSample/UI/Images/delta.png differ diff --git a/Sample/PegasusSample/UI/Images/gamma.png b/Sample/PegasusSample/UI/Images/gamma.png new file mode 100644 index 0000000..7382e37 Binary files /dev/null and b/Sample/PegasusSample/UI/Images/gamma.png differ diff --git a/Sample/PegasusSample/sample4.xml b/Sample/PegasusSample/UI/sample4.xml similarity index 52% rename from Sample/PegasusSample/sample4.xml rename to Sample/PegasusSample/UI/sample4.xml index 4ec2d64..a508896 100644 --- a/Sample/PegasusSample/sample4.xml +++ b/Sample/PegasusSample/UI/sample4.xml @@ -1,22 +1,22 @@ diff --git a/Sample/PegasusSample/UI/sample5.xml b/Sample/PegasusSample/UI/sample5.xml new file mode 100644 index 0000000..f39da0f --- /dev/null +++ b/Sample/PegasusSample/UI/sample5.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file