【发布时间】:2014-01-05 02:57:04
【问题描述】:
我对 Xcode/应用程序开发有点陌生
我目前正在尝试在我的视图控制器中编写 4 个静态单元格。但是,当我运行我的应用程序时,tableview 没有显示。
这里是ios模拟器中发生的截图:
这里是我的 tableview 及其在情节提要中的属性的图像:
我的 SettingsViewController.h 文件:
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface SettingsViewController : UIViewController < MFMailComposeViewControllerDelegate>
@property (weak, nonatomic) IBOutlet UIBarButtonItem *sidebarButton;
@end
我的 SettingsViewController.m 文件:
#import "SettingsViewController.h"
#import "SWRevealViewController.h"
@interface SettingsViewController ()
@property (nonatomic, strong) NSArray *menuItems;
@end
@implementation SettingsViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_sidebarButton.target = self.revealViewController;
_sidebarButton.action = @selector(revealToggle:);
_sidebarButton.tintColor = [UIColor colorWithWhite:0.1f alpha:0.7f];
// Add pan gesture to hide the sidebar
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
// Do any additional setup after loading the view.
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.row == 0 && indexPath.section == 0){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://myawesomeapp.com/support"]];
} else if(indexPath.row == 0 && indexPath.section == 1){
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setSubject:@"[My Awesome App] Support request"];
[mailViewController setToRecipients:[NSArray arrayWithObject:@"support@myawesomeapp.com"]];
[self presentModalViewController:mailViewController animated:YES];
}
}
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{
[self dismissModalViewControllerAnimated:YES];
}
到底是什么问题?
【问题讨论】:
标签: ios iphone objective-c uitableview