UIPopoverController 使用 UINavigationBar中添加左箭头返回按钮

本文介绍如何在iOS应用中创建一个从UINavigationBar触发的UIPopoverController弹窗,并展示了如何手动添加带有返回箭头的导航项。
-(void) onSetting:(id) sender {
 
    SplitBaseController *detail = [[SettingServerController alloc] init];
 
    CGRect frame = [(UIView *)sender frame];
    frame.origin.y = 0;
 
    UIPopoverController *popwin = [[UIPopoverController alloc] initWithContentViewController:detail];
    [popwin setPopoverContentSize:CGSizeMake(400, 300) animated:YES];
    popwin.delegate = self;
    [popwin presentPopoverFromRect: frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
 
    [detail release];
在UINavigationBar中添加左箭头返回按钮
在iPhone里面最讨厌的控件之一就是 UINavigationBar了。这个控件样式修改不方便,连添加按钮也特别麻烦。下面的例子是如何手动添加带箭头的按钮:
UINavigationItem *item = [navBar.items objectAtIndex:0];
UINavigationItem *back = [[UINavigationItem alloc] initWithTitle:@"Back"];
NSArray *items = [[NSArray alloc] initWithObjects:back,item,nil];
[navBar setItems:items];
 
- (BOOL)navigationBar:(UINavigationBar *)navigationBar
shouldPopItem:(UINavigationItem *)item{
//在此处添加点击back按钮之后的操作代码
return NO;
}

(void) onSetting:(id) sender {
 
    SplitBaseController *detail = [[SettingServerController alloc] init];
 
    CGRect frame = [(UIView *)sender frame];
    frame.origin.y = 0;
 
    UIPopoverController *popwin = [[UIPopoverController alloc] initWithContentViewController:detail];
    [popwin setPopoverContentSize:CGSizeMake(400, 300) animated:YES];
    popwin.delegate = self;
    [popwin presentPopoverFromRect: frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
 
    [detail release];
数据集介绍:微塑料目标检测数据集一、基础信息数据集名称:微塑料目标检测数据集图片数量:- 训练集:3,261张图片- 验证集:922张图片- 测试集:459张图片分类类别:- Microplastic(微塑料):环境中广泛存在的微小塑料颗粒,需通过专业检测设备识别。标注格式:- YOLO格式,包含目标边界框坐标及类别标,适用于目标检测任务。二、适用场景环境监测与生态研究:支持开发AI模型用于检测空气、水体或土壤中的微塑料分布,助力环境污染评估与治理。废弃物管理优化:集成至工业检测系统,实时识别废弃物中的微塑料成分,提升垃圾分类和回收效率。科研数据支撑:为环境科学、材料科学等领域提供标准化数据,推动微塑料污染机理研究。教育科普应用:作为教学案例资源,帮助学生和公众直观理解微塑料的形态及检测方法。三、数据集优势精准标注与场景覆盖:- 标注数据经环境科学专家审核,边界框定位精确,类别标一致性强。- 涵盖多种环境场景样本,确保模型泛化能力。任务适配性突出:- 兼容YOLO系列算法(v5/v7/v8等),可直接用于目标检测模型训练与验证。- 支持扩展至颗粒计数、分布密度分析等衍生任务。环境应用价值显著:- 聚焦全球关注的微塑料污染问题,为环保机构和企业提供关键数据支持。- 数据来源于专业检测设备采集,符合科研级检测标准。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值