I am creating a NC Widget and can’t seem to adjust the height of the widget.
Here is my code:
-(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];
}
This is an example of how you can do that :
If you are developing a plugin for the notification Center, refer to the BBWeeAppController-Protocol.h you will need also to implement this method : “- (float)viewHeight”.
Also, I have seen from your code you are using theses methods “stretchableImageWithLeftCapWidth:5 topCapHeight:71”, that are deprecated in IOS 5.0 –> https://developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/instm/UIImage/stretchableImageWithLeftCapWidth:topCapHeight: So, use the method “resizableImageWithCapInsets” ;-).
I’m not a pro on it, I’m learning ObjC, so if you have somes questions, let me know.