创建的UIBarButtonItem为什么显示不出来
展开全部
[cpp]viewplaincopy//首先需要创建一个NSMutableArrayNSMutableArray*buttons=[[NSMutableArrayalloc]initWithCapacity:3];[buttonsautorelease];//创建一个UIBarButtonItem系统刷新按钮并且加入到Array中UIBarButtonItem*freshButton=[[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemRefreshtarget:selfaction:@selector(OnrefreshMap:)];[buttonsaddObject:freshButton];[freshButtonrelease];//创建一个空格,加入到array,用来将下面加入的按钮按照右边对齐UIBarButtonItem*SpaceButton=[[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpacetarget:nilaction:nil];[buttonsaddObject:SpaceButton];[SpaceButtonrelease];//创建一个系统搜索按钮,加入到array,放到右边UIBarButtonItem*searchSelfButton=[[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSearchtarget:selfaction:@selector(OnFindSelf:)];[buttonsaddObject:searchSelfButton];[searchSelfButtonrelease];//最后,将array设置给toolbar[toolbarsetItems:buttonsanimated:YES];[toolbarsizeToFit];
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询