Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone tt按钮未显示_Iphone_Objective C_Xcode_Three20 - Fatal编程技术网

Iphone tt按钮未显示

Iphone tt按钮未显示,iphone,objective-c,xcode,three20,Iphone,Objective C,Xcode,Three20,我使用以下代码在我的loadView方法中添加TTButton: TTButton* button2 = [TTButton buttonWithStyle:@"forwardActionButton:" title:@"Login"]; [button2 setFrame:CGRectMake(245, 160, 65, 33)]; [self.view addSubview:button2]; 但是按钮没有出现 你知道我错过了什么吗?(我在头文件中导入了) 谢谢,这段代码看起来不错。您在哪

我使用以下代码在我的loadView方法中添加TTButton:

TTButton* button2 = [TTButton buttonWithStyle:@"forwardActionButton:" title:@"Login"];
[button2 setFrame:CGRectMake(245, 160, 65, 33)];
[self.view addSubview:button2];
但是按钮没有出现

你知道我错过了什么吗?(我在头文件中导入了)


谢谢,

这段代码看起来不错。您在哪里声明“forwardActionButton”样式?据我所知,这不是一个现有的3-20 TTStyle。任何自定义样式都应位于样式表类中,并应加载到应用程序委托中,如下所示:

[TTStyleSheet setGlobalStyleSheet:[[[StyleSheet alloc] init] autorelease]];
您还可以尝试使用现有的TTStyle,例如“toolbarForwardButton:”,并查看其是否有效

下面是一个使用TTButton并将函数选择器设置为按钮目标的工作示例:

TTButton* storyButton = [TTButton buttonWithStyle:@"toolbarRoundButton:" title:@"Open Full Story"];

storyButton.font = [UIFont boldSystemFontOfSize:18];
storyButton.frame = CGRectMake(100, 100, 200, 50);

[storyButton addTarget:self action:@selector(presentFullStory) forControlEvents:UIControlEventTouchUpInside];
[storyButton sizeToFit];
[self.view addSubview:storyButton];