1天学习1个类库 UILocalNotification 示例

iOS UILocalNotification scheduleLocalNotification 收不到通知 今天用UILocalNotification增加本地通知,很奇怪,调用scheduleLocalNotification完全收不到通知,但是调用 presentLocalNotificationNow就能收到。网上查了资料,看到苹果官方下面一段话:  Local and Remote Notification Programming Guide: In iOS 8 and l 阅读详情

直接发代码:


//
//  main.m
//  ControlDemo
//
//  Created by watsy0007 on 12-6-3.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Social/Social.h>


#define BARBUTTONITEM(bar,title,act) UIBarButtonItem *bar = [[UIBarButtonItem alloc] initWithTitle:title \
style:UIBarButtonItemStylePlain \
target:self \
action:act];

@interface ViewController : UIViewController {

}

@end


@implementation ViewController

- (void) dealloc {

    [super dealloc];
}


- (void) loadView {
    [super loadView];
    
    [[self view] setBackgroundColor:[UIColor whiteColor]];
}

- (void) viewDidLoad {
    [super viewDidLoad];
    
    UILocalNotification *noti = [[UILocalNotification alloc] init];
    noti.fireDate =  [NSDate dateWithTimeIntervalSinceNow:10];
    noti.timeZone = [NSTimeZone defaultTimeZone];
    noti.repeatInterval=NSCalendarCalendarUnit;
    noti.repeatInterval = NSDayCalendarUnit;
    noti.alertBody = @"xxxxxxxxxxxx";
    noti.alertAction = @"本地通知Demo";
    noti.soundName = UILocalNotificationDefaultSoundName;
    noti.alertLaunchImage = @"alertLaunchImage";
    
    
    [[UIApplication sharedApplication] scheduleLocalNotification:noti];
    
    [noti release];
}

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return YES;
}

@end


//-----------------------------------------------------------------------------------------------------

#pragma mark -
#pragma mark AppDelegate
@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIViewController *viewController;

@end

@implementation AppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;

- (void) dealloc {
    [_window release];
    [_viewController release];
    
    [super dealloc];
}

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    srand(time(NULL));
    
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    
    self.viewController = [[ViewController alloc] init];
    
    UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:self.viewController]; 
    self.window.rootViewController = controller;
    [controller release];
    
    [self.window makeKeyAndVisible];
    return YES;
}

@end

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}


iOS开发——在特定时间、任意时间做本地推送UILocalNotification 当需要发送一个本地推送的时候,我们需要为其设置fireTime即发送时间,网上好多示例代码只是简单地将一个类似10秒之后的时间设上去,但我们可能更需要在自定义或用户定义的某个特定的时间发送,其实这也不难,算是OC的知识点了——对常用类之时间类的运用。 阅读详情

相关推荐

usb gadget uvc driver的code分析

uvc的linux driver分为host侧和gadget侧两个driver。host侧的driver在v4l2框架下,而设备侧的driver在usb/gadget文件夹下。gadget侧的uvc driver,利用v4l2框架去注册video_device,向应用层提供调用接口。同时,它完成v4l2 video buffer拷贝到usb request下的buffer下,然后利用uvc实现的协

lintwins的专栏 1万+

UILocalNotification 本地通知

//UILocalNotification 本地通知 // 1.创建初始化本地通知 UILocalNotification *localNotification = [[UILocalNotification alloc] init]; // 2.设置属性 // 2.1 设置标题 localNotification.alertA

214

【从零开始玩量化1】AKShare: Python开源财经数据接口库

文章目录量化的第一步:数据AKShare介绍AKShare安装AKShare使用AKTools安装/使用结语 量化的第一步:数据 想要玩量化,第一步要有数据,这个数据可能是历史交易数据、财务数据、宏观数据等等。我们最终要做的,无非就是从数据中分析出有价值的信息,以便用来指导投资策略。 在获取数据的这条道路上,我走了很多弯路,尝试了各种方法:使用Tushare到放弃、自己写网易股票页面的爬虫,自己写申万行业数据的爬虫、自己写同花顺问财的爬虫、使用聚宽的免费数据API等等,直到最终,我发现了AKShare。 A

量化投资助手的博客 5万+

iOS8新特性之基于地理位置的消息通知UILocalNotification

苹果在WWDC2014上正式发布了全新的iOS8操作系统。界面上iOS8与iOS7相比变化不大,不过在功能方面进行了完善。                                      iOS8中更新和公开了很多接口,其中有一项本地消息通知UILocalNotification,大家肯定都不陌生。但是在iOS8中对其进行了优化和改进。现在它可以根据地理位置发起消息通知,即我们在A

如鱼得水的专栏 5496

RTX 50系列显卡选购指南:从Stable Diffusion到深度学习,哪款最适合你的AI需求?

本文深入分析了RTX 50系列显卡如何满足不同的AI应用需求。针对Stable Diffusion图像生成,强调显存容量是关键;对于大语言模型本地推理,需平衡算力与显存;而深度学习训练则更看重算力效率。文章对比了RTX 5090、5080、5070等型号的核心规格与适用场景,并提供了从入门到专业的实战配置建议,帮助用户根据自身AI工作负载精准选择最具性价比的显卡。

linux6sysadmin的博客 694

无监督低照度增强实战:用ZeroDCE和SCI拯救你的夜间照片(附PyTorch代码)

本文深入探讨了无监督低照度图像增强技术,重点解析了ZeroDCE和SCI两大代表性模型的核心原理与实战应用。通过对比分析两者的技术路径、网络结构及性能特点,并附上详细的PyTorch代码实现,旨在帮助读者掌握无需配对数据即可有效提升夜间照片画质的深度学习解决方案。

git9versioner的博客 490

iOS 10中不推荐使用UILocalNotification(UILocalNotification is deprecated in iOS 10)

It may be a question in advance but I wonder what to use instead of UILocalNotification in iOS 10. I am working on an app which has deployment target iOS 8 so will it be ok to use UILocalNotification? 解决方案 Yes, you can use UILocalNotification, old APIs a

feelinghappy的专栏 1450

保姆级教程:在RK3588开发板上用MPP库实现H.264硬编码(附完整代码)

本文详细介绍了在RK3588开发板上使用MPP库实现H.264硬编码的全流程,包括环境准备、MPP库编译、编码器初始化与配置、数据输入与编码流程以及高级性能优化技巧。通过实战案例和完整代码,帮助开发者充分利用RK3588的VPU硬件加速能力,提升视频编码效率和质量。

weixin_28716769的博客 414

UILocalNotification 的使用

- (UILocalNotification*) createLocalNotificationWithContent:(NSString*) content{ UILocalNotification *notification=[[[UILocalNotification alloc] init] autorelease]; if (notification!=nil) {

reylen的专栏 2428

NEU-DET 冷轧钢缺陷检测:基于 YOLOv8 的目标检测与可视化 UI 实现

冷轧钢的生产过程中,由于设备故障、工艺问题或者人为因素,钢板表面可能会出现多种缺陷,如划痕、裂纹、孔洞等,这些缺陷会严重影响钢材的质量。它比之前的版本(如 YOLOv5、YOLOv4)在速度和精度上都有显著提升,并且对硬件要求较低,适合进行工业界面和嵌入式系统的应用。这些版本相较于更大型的模型(如 YOLOv8x)具有更快的推理速度和较低的资源占用,适合工业生产线中的实时应用。通过将训练好的模型部署到工业生产线摄像头中,我们可以实现实时的缺陷检测,极大地提升生产效率和产品质量。

YOLO 739

基于STM32+RFID设计的宿舍检修管理系统

设计一个上位机,用来管理查看维修检修信息,当维修寝室的设备或者检修完成时,通过STM32上的RC522刷一下这个寝室的IC卡,识别这是哪个寝室,识别成功后在软件上弹出一个对话框,填写本次维修或者检修的事件,填写完毕点击提交即可。...

2557

iOS UILocalNotification本地通知

介绍一下iOS下如何使用UILocalNotification进行应用程序的本地通知,基本上大部分的app都会有这个功能。      我们在设置的通知中心中可以自定义本地通知的三种形式(分别是在ios6和ios7):                         下面给出简单代码看看如何使用UILocalNotification: (1)本地通知中心发送消息: UILo

小邓笔记 1万+

RK3588 C++ MeloTTS 推理

本文介绍了基于RK3588平台和RKNN工具链实现的端侧语音合成(TTS)系统。该系统支持中英文混合输入处理,通过自动合并英文单词、转换标点符号等方式预处理文本,并将其转换为音素和声调序列。核心推理流程包含编码器、中间处理和解码器三个阶段:编码器将音素序列转为隐藏状态,中间处理调节音调和语速,解码器生成最终波形。代码示例展示了输入数据设置和模型推理过程,利用RK3588内置NPU实现高效语音合成。该系统展现了在边缘计算设备上实现复杂AI任务的能力。

J。 200

UILocalNotification的学习

示例代码:http://download.youkuaiyun.com/detail/chenscda/7230625 介绍一下iOS下如何使用UILocalNotification进行应用程序的本地通知,基本上大部分的app都会有这个功能。 我们在设置的通知中心中可以自定义本地通知的三种形式(分别是在ios6和ios7): 下面给出简单...

weixin_30486037的博客 153

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

UILocalNotification的使用

UILocalNotification一般做为定时器使用,可以定时提醒,定时唤醒。 1.对象的创建    UILocalNotification *notification = [[UILocalNotification alloc] init];     NSDateFormatter *formatter = [[NSDateFormatter alloc] init];     NS

813

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

iOS 本地推送通知 UILocalNotification

wang'shang

Run of the fish 728

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

iOS开发之UILocalNotification本地通知

在实际iOS开发中,都会用到,iOS的通知有本地通知和远程通知两种。 在这里介绍一下iOS下如何使用UILocalNotification进行应用程序的本地通知,基本上大部分的app都会有这个功能。 (1)本地通知中心发送消息: UILocalNotification *notification=[[UILocalNotification alloc] init]; if (

sky_2016的专栏 661

UILocalNotification

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33958366的博客 107

iOS --- 本地推送通知 UILocalNotification

本地推送UILocalNotification常用于定期提醒用户使用该APP,如AirBrush的定期提醒用户拍照,运动锻炼工具的每天锻炼提醒。不同于远程推送RemoteNotification,本地推送一般较固定,通常事先设置好推送周期。而推送内容往往也是固定的,可存放于plist文件中。本地推送并不依赖于网络连接,可简单将其视为一个定时装置即可。

icetime17的专栏 2285

本地通知 UILocalNotification

1. - (void)viewDidLoad {     [super viewDidLoad];     [self  SendLocalNotification]; } -(void)SendLocalNotification{     UILocalNotification *localNotification = [[U

陈凯的博客 4212

iOS本地通知UILocalNotification

UILocalNotification *notification=[[UILocalNotification alloc] init]; if (notification!=nil) { NSDate *now=[NSDate new]; notification.fireDate=[now dateByAddingTimeInterval:10];//10秒后通知 notificati

The Life with iOS 945

Swift - 推送之本地推送(UILocalNotification)

// 本地推送通知是通过实例化UILocalNotification实现的。要实现本地化推送可以在AppDelegate.swift中添加代码实现,本事例是一个当App进入后台时推送一条消息给用户。          func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [

gongyuhonglou的博客 1130

iOS下的UILocalNotification的使用

iOS下的Notification的使用  Notification是智能手机应用编程中非常常用的一种传递信息的机制,而且可以非常好的节省资源,不用消耗资源来不停地检查信息状态(Pooling),在iOS下应用分为两种不同的Notification种类,本地和远程。本地的Not

张中峰的专栏 1万+
上一篇: UIKeyboard 类的一些属性和使用
下一篇: UiTableView 使用技巧1 (datamodel与datasource独立)
watsy
博客等级 码龄19年 133粉丝 104原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值