ios - 带有静态单元格的 TableView Controller

标签 ios objective-c methods tableview

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

#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 - 带有静态单元格的 TableView Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22021046/

相关文章:

ios - 动态单元格高度自动布局 IOS

ios - 创建自己的 iOS 音乐播放器并显示在 iPhone 的锁屏上

ios - Linkedin 登录使用 oAuth 1.0a

ios - 我如何在没有 ALAssetsLibrary 的情况下从 "UIImagePickerControllerReferenceURL"获取 UIImage

JavaScript:在方法中使用对象变量

Javascript 函数参数处理

ios - Swift/浮点运算

ios - 为什么我的函数输出一个看起来像内存地址的随机值?

objective-c - 为什么[NSLocale currentLocale]返回id?

java - 错误从 Java 中的函数返回 double 值