diff --git a/AAMFeedback.podspec b/AAMFeedback.podspec new file mode 100644 index 0000000..bc33619 --- /dev/null +++ b/AAMFeedback.podspec @@ -0,0 +1,14 @@ +Pod::Spec.new do |s| + s.name = 'AAMFeedback' + s.version = '0.0.1' + s.platform = :ios, '5.0' + s.license = { :type => 'Modified BSD' } + s.homepage = 'https://github.com/fladdict/AAMFeedback' + s.summary = 'Library that you can add User feedback form in you app on the fly. :-)' + s.author = 'Takayuki Fukatsu' + s.source = { :git => 'https://github.com/fladdict/AAMFeedback.git' } + s.source_files = 'AAMFeedback/AAMFeedback/*.{h,m}' + s.resource = 'AAMFeedback/AAMFeedback.bundle' + s.requires_arc = false + s.frameworks = 'UIKit', 'MessageUI', 'CoreGraphics' +end diff --git a/AAMFeedback/en.lproj/Localizable.strings b/AAMFeedback/AAMFeedback.bundle/en.lproj/Localizable.strings similarity index 100% rename from AAMFeedback/en.lproj/Localizable.strings rename to AAMFeedback/AAMFeedback.bundle/en.lproj/Localizable.strings diff --git a/AAMFeedback/ja.lproj/Localizable.strings b/AAMFeedback/AAMFeedback.bundle/ja.lproj/Localizable.strings similarity index 100% rename from AAMFeedback/ja.lproj/Localizable.strings rename to AAMFeedback/AAMFeedback.bundle/ja.lproj/Localizable.strings diff --git a/AAMFeedback/AAMFeedback/AAMFeedbackTopicsViewController.m b/AAMFeedback/AAMFeedback/AAMFeedbackTopicsViewController.m index d0ffb47..b78c4b2 100644 --- a/AAMFeedback/AAMFeedback/AAMFeedbackTopicsViewController.m +++ b/AAMFeedback/AAMFeedback/AAMFeedbackTopicsViewController.m @@ -8,6 +8,8 @@ #import "AAMFeedbackTopicsViewController.h" +#define LocalizedString(stringKey) \ + [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"AAMFeedback" ofType:@"bundle"]] localizedStringForKey:stringKey value:stringKey table:nil] @interface AAMFeedbackTopicsViewController(private) - (void)_setSelectedIndex:(int)theIndex; @@ -26,7 +28,7 @@ @implementation AAMFeedbackTopicsViewController - (void)viewDidLoad { [super viewDidLoad]; - self.title = NSLocalizedString(@"AAMFeedbackTopicsTitle", nil); + self.title = LocalizedString(@"AAMFeedbackTopicsTitle"); } - (void)viewDidUnload @@ -83,7 +85,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } - cell.textLabel.text = NSLocalizedString([[self _topics]objectAtIndex:indexPath.row],nil); + cell.textLabel.text = LocalizedString([[self _topics]objectAtIndex:indexPath.row]); return cell; } diff --git a/AAMFeedback/AAMFeedback/AAMFeedbackViewController.m b/AAMFeedback/AAMFeedback/AAMFeedbackViewController.m index 7a7b3fe..2dea899 100644 --- a/AAMFeedback/AAMFeedback/AAMFeedbackViewController.m +++ b/AAMFeedback/AAMFeedback/AAMFeedbackViewController.m @@ -11,6 +11,9 @@ #include #include +#define LocalizedString(stringKey) \ + [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"AAMFeedback" ofType:@"bundle"]] localizedStringForKey:stringKey value:stringKey table:nil] + @interface AAMFeedbackViewController(private) - (NSString *) _platform; - (NSString *) _platformString; @@ -88,10 +91,10 @@ - (void)dealloc { - (void)loadView { [super loadView]; - self.title = NSLocalizedString(@"AAMFeedbackTitle", nil); + self.title = LocalizedString(@"AAMFeedbackTitle"); self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelDidPress:)]autorelease]; - self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithTitle:NSLocalizedString(@"AAMFeedbackButtonMail", nil) style:UIBarButtonItemStyleDone target:self action:@selector(nextDidPress:)]autorelease]; + self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithTitle:LocalizedString(@"AAMFeedbackButtonMail") style:UIBarButtonItemStyleDone target:self action:@selector(nextDidPress:)]autorelease]; } - (void)viewDidLoad @@ -165,10 +168,10 @@ - (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteg { switch (section) { case 0: - return NSLocalizedString(@"AAMFeedbackTableHeaderTopics", nil); + return LocalizedString(@"AAMFeedbackTableHeaderTopics"); break; case 1: - return NSLocalizedString(@"AAMFeedbackTableHeaderBasicInfo", nil); + return LocalizedString(@"AAMFeedbackTableHeaderBasicInfo"); break; default: break; @@ -205,7 +208,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N _descriptionPlaceHolder = [[[UITextField alloc]initWithFrame:CGRectMake(16, 8, 300, 20)]autorelease]; _descriptionPlaceHolder.font = [UIFont systemFontOfSize:16]; - _descriptionPlaceHolder.placeholder = NSLocalizedString(@"AAMFeedbackDescriptionPlaceholder", nil); + _descriptionPlaceHolder.placeholder = LocalizedString(@"AAMFeedbackDescriptionPlaceholder"); _descriptionPlaceHolder.userInteractionEnabled = NO; [cell.contentView addSubview:_descriptionPlaceHolder]; @@ -220,8 +223,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N switch (indexPath.row) { case 0: - cell.textLabel.text = NSLocalizedString(@"AAMFeedbackTopicsTitle", nil); - cell.detailTextLabel.text = NSLocalizedString([self _selectedTopic],nil); + cell.textLabel.text = LocalizedString(@"AAMFeedbackTopicsTitle"); + cell.detailTextLabel.text = LocalizedString([self _selectedTopic]); break; case 1: default: