Skip to content

Commit

Permalink
Added initial support for sponsors, and hide the sponsors button if t…
Browse files Browse the repository at this point in the history
…here aren't any for an event
  • Loading branch information
Michael Nachbaur committed Feb 11, 2011
1 parent 9d174b3 commit e388a4b
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 7 deletions.
1 change: 1 addition & 0 deletions Classes/MainMenuViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@interface MainMenuViewController : UIViewController {
EventModel *_eventObject;
UIImageView *_headerImageView;
IBOutlet UIButton *_sponsorsButton;

@private
NSManagedObjectContext *_managedObjectContext;
Expand Down
10 changes: 10 additions & 0 deletions Classes/MainMenuViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ - (void)viewDidLoad {
self.navigationItem.title = self.eventObject.title;
[self.headerImageView setImage:self.eventObject.headerImage];

// Update view layers to make it mo-bettah
for (UIView *subview in self.view.subviews) {
switch (subview.tag) {
case MainMenuViewControllerViewTagRoundedBox:
Expand All @@ -42,10 +43,19 @@ - (void)viewDidLoad {
break;
}
}

// Conditionally show buttons on this view
if ([self.eventObject.sponsors count] == 0) {
[_sponsorsButton removeFromSuperview];
[_sponsorsButton release];
_sponsorsButton = nil;
}
}

- (void)dealloc {
self.managedObjectContext = nil;
if (_sponsorsButton)
[_sponsorsButton release];

[super dealloc];
}
Expand Down
43 changes: 36 additions & 7 deletions Classes/MainMenuViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@
</object>
<int key="connectionID">35</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">_sponsorsButton</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="1067658937"/>
</object>
<int key="connectionID">36</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
Expand Down Expand Up @@ -608,7 +616,7 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">35</int>
<int key="maxID">36</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down Expand Up @@ -691,14 +699,35 @@
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">headerImageView</string>
<string key="NS.object.0">UIImageView</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>_sponsorsButton</string>
<string>headerImageView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIButton</string>
<string>UIImageView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">headerImageView</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">headerImageView</string>
<string key="candidateClassName">UIImageView</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>_sponsorsButton</string>
<string>headerImageView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">_sponsorsButton</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">headerImageView</string>
<string key="candidateClassName">UIImageView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
Expand Down
7 changes: 7 additions & 0 deletions iYAPC.xcdatamodeld/EventModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@class DayModel;
@class TrackModel;
@class VenueModel;
@class SponsorModel;

@interface EventModel : NSManagedObject
{
Expand All @@ -24,6 +25,7 @@
@property (nonatomic, retain) NSSet* tracks;
@property (nonatomic, retain) VenueModel * venue;
@property (nonatomic, retain) NSSet* days;
@property (nonatomic, retain) NSSet* sponsors;

@property (nonatomic, retain) NSString * headerImageUrl;
@property (nonatomic, retain) UIImage * headerImage;
Expand All @@ -42,5 +44,10 @@
- (void)addDays:(NSSet *)value;
- (void)removeDays:(NSSet *)value;

- (void)addSponsorsObject:(SponsorModel *)value;
- (void)removeSponsorsObject:(SponsorModel *)value;
- (void)addSponsors:(NSSet *)value;
- (void)removeSponsors:(NSSet *)value;

@end

2 changes: 2 additions & 0 deletions iYAPC.xcdatamodeld/EventModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "DayModel.h"
#import "TrackModel.h"
#import "VenueModel.h"
#import "SponsorModel.h"

@implementation EventModel

Expand All @@ -22,6 +23,7 @@ @implementation EventModel
@dynamic tracks;
@dynamic venue;
@dynamic days;
@dynamic sponsors;

@dynamic headerImageUrl;
@dynamic headerImage;
Expand Down
22 changes: 22 additions & 0 deletions iYAPC.xcdatamodeld/SponsorModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// SponsorModel.h
// iYAPC
//
// Created by Michael Nachbaur on 11-02-10.
// Copyright 2011 Decaf Ninja Software. All rights reserved.
//

#import <CoreData/CoreData.h>

@class EventModel;

@interface SponsorModel : NSManagedObject
{
}

@property (nonatomic, retain) EventModel * event;

@end



17 changes: 17 additions & 0 deletions iYAPC.xcdatamodeld/SponsorModel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// SponsorModel.m
// iYAPC
//
// Created by Michael Nachbaur on 11-02-10.
// Copyright 2011 Decaf Ninja Software. All rights reserved.
//

#import "SponsorModel.h"

#import "EventModel.h"

@implementation SponsorModel

@dynamic event;

@end
Binary file modified iYAPC.xcdatamodeld/iYAPC.xcdatamodel/elements
Binary file not shown.
Binary file modified iYAPC.xcdatamodeld/iYAPC.xcdatamodel/layout
Binary file not shown.
6 changes: 6 additions & 0 deletions iYAPC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
1B2D483712BA703100745347 /* TestEvents.xml in Resources */ = {isa = PBXBuildFile; fileRef = 1B2D483612BA703100745347 /* TestEvents.xml */; };
1B3F55FA13007DBC008D97BA /* libDecafNinja.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B3F55F913007DBC008D97BA /* libDecafNinja.a */; };
1B552F8E1304FA69009D5597 /* InfoPanelAppObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B552F8D1304FA69009D5597 /* InfoPanelAppObject.m */; };
1B552FFE130509EC009D5597 /* SponsorModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B552FFD130509EC009D5597 /* SponsorModel.m */; };
1B67ACCF1301A37D0071AB25 /* InfoPanelViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1B67ACCC1301A37D0071AB25 /* InfoPanelViewController.xib */; };
1B67ACD01301A37D0071AB25 /* InfoPanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B67ACCE1301A37D0071AB25 /* InfoPanelViewController.m */; };
1B67AD4C1303B5680071AB25 /* Icon-512.png in Resources */ = {isa = PBXBuildFile; fileRef = 1B67AD461303B5680071AB25 /* Icon-512.png */; };
Expand Down Expand Up @@ -132,6 +133,8 @@
1B3F55F913007DBC008D97BA /* libDecafNinja.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libDecafNinja.a; sourceTree = "<group>"; };
1B552F8C1304FA69009D5597 /* InfoPanelAppObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoPanelAppObject.h; sourceTree = "<group>"; };
1B552F8D1304FA69009D5597 /* InfoPanelAppObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InfoPanelAppObject.m; sourceTree = "<group>"; };
1B552FFC130509EC009D5597 /* SponsorModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SponsorModel.h; sourceTree = "<group>"; };
1B552FFD130509EC009D5597 /* SponsorModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SponsorModel.m; sourceTree = "<group>"; };
1B67ACCC1301A37D0071AB25 /* InfoPanelViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = InfoPanelViewController.xib; sourceTree = "<group>"; };
1B67ACCD1301A37D0071AB25 /* InfoPanelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoPanelViewController.h; sourceTree = "<group>"; };
1B67ACCE1301A37D0071AB25 /* InfoPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InfoPanelViewController.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -692,6 +695,7 @@
1B67ACD01301A37D0071AB25 /* InfoPanelViewController.m in Sources */,
1B67ADE31304E4790071AB25 /* WebViewController.m in Sources */,
1B552F8E1304FA69009D5597 /* InfoPanelAppObject.m in Sources */,
1B552FFE130509EC009D5597 /* SponsorModel.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -845,6 +849,8 @@
28D3F201112F7DC200FD0661 /* iYAPC.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
1B552FFC130509EC009D5597 /* SponsorModel.h */,
1B552FFD130509EC009D5597 /* SponsorModel.m */,
1BFAC45E12F8839A00D02141 /* TrackModel.h */,
1BFAC45F12F8839A00D02141 /* TrackModel.m */,
1BD98B9812E91D3D001C2BB0 /* SessionModel.h */,
Expand Down

0 comments on commit e388a4b

Please sign in to comment.