【发布时间】:2011-10-17 02:47:47
【问题描述】:
我正在创建一个NC Widget,但似乎无法调整小部件的高度。
这是我的代码:
-(UIView *)view {
if (_view == nil)
{
CGRect frame = CGRectMake(2,0,316,191); // Added
_view = [[[UIView alloc] initWithFrame:(frame)] autorelease]; //(2., 0., 316., 71.)]; <--ORIGINAL VALUE
// Setting frame Height dont work... :/
UIImage *bg = [[UIImage imageWithContentsOfFile:@"/System/Library/WeeAppPlugins/SMSWidget.bundle/Background.png"] stretchableImageWithLeftCapWidth:5 topCapHeight:71];
UIImageView *bgView = [[UIImageView alloc] initWithImage:bg];
bgView.frame = CGRectMake(0, 0, 316, 191);
[_view addSubview:bgView];
[bgView release];
}
【问题讨论】:
-
这是哪里?如果它在 UIViewController 中,则覆盖 loadView。
-
到底发生了什么?更具体地说明问题。只是发布一个吸气剂可以是任何事情..
-
好的,我正在为 iPhone 进行调整,我需要获取视图以更改高度大小...我该怎么做?更改值不起作用...:/
-
将 _view 更改为 view.. 简单来说,这段代码可以代表我们的任何东西 -(UIView *)view { // code } 的用途.. 它是您使用的函数还是只是在此处表示代码..请更具体。
-
不能那样做,结果不好...但是 -(UIView *)view {//code} 是用于设置视图.. ( UI )。
标签: iphone objective-c uiview height