【问题标题】:Table view controller with static cells带有静态单元格的表格视图控制器
【发布时间】:2014-02-25 16:58:47
【问题描述】:

我的应用程序有问题,所以当我将此代码放入 InfoViewController 并运行应用程序时,视图似乎是空的。我有一个表格视图设置为静态单元格,3 个部分,样式与标题分组每个部分,第一个单元格包含一个文本字段,我已将其用作谷歌的搜索字段,以及一个搜索按钮,第二个和第三个包含一个标签。我已连接故事板文件中的所有文本字段按钮和标签,和文件所有者中的委托。我应该实现任何其他方法吗? 谢谢你的建议。

#import <UIKit/UIKit.h>

@interface InfoViewController : UIViewController <UINavigationControllerDelegate>

@property (weak, nonatomic) IBOutlet UITextField *googleSearchTextField;

@property (weak, nonatomic) IBOutlet UIButton *searchButton;

@property (weak, nonatomic) IBOutlet UILabel *Label1;

@property (weak, nonatomic) IBOutlet UILabel *Label2;

-(IBAction)googleSearch;

@end





#import "InfoViewController.h"

@end

@implementation InfoViewController

@synthesize googleSearchTextField;
@synthesize searchButton;
@synthesize Label1;
@synthesize Label2;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}

- (void)viewDidLoad
{
[super viewDidLoad];


self.Label1.text = @“Label1”;
self.Label2.text = @“Label2”;

}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (BOOL)textFieldShouldReturn:(UITextField*)textField
{
[textField resignFirstResponder];
return YES;
}

-(IBAction)googleSearch
{
NSString *searchString=googleSearchTextField.text;
NSString *urlAdress = [NSString stringWithFormat:@"http://www.google.com/search?q=%@",         
searchString];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlAdress]];
}


@end 

【问题讨论】:

    标签: ios objective-c methods tableview


    【解决方案1】:

    【讨论】:

    • 也适用于静态单元格?
    猜你喜欢
    • 2014-09-02
    • 1970-01-01
    • 2012-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多