一.
1.导入制作二维码的第三方libqrencode
2.在viewController中导入头文件
#import "QRCodeGenerator.h"
3.在xib中拖入控件并关联
4. 在制作二维码按钮
self.IMG.image = [QRCodeGenerator qrImageForString:self.contentTF.text imageSize:self.IMG.frame.size.width];
//保存二维码并给与二维码图片名称
NSString * qq = [NSString stringWithFormat:@"%@/123.png",NSHomeDirectory()];
[UIImagePNGRepresentation(self.IMG.image) writeToFile:qq atomically:YES];
5.在显示按钮中跳转
[self.navigationController pushViewController:[oneViewController new] animated:YES];
二.
1.在第二个界面创建xib并拖入控件并关联
2.在第二个界面中实现
NSString * qq = [NSString stringWithFormat:@"%@/123.png",NSHomeDirectory()];
self.IMG1.image = [UIImage imageWithContentsOfFile:qq]
3.添加系统方法
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[self.navigationController popViewControllerAnimated:YES];
}
三.
1.导入友盟推送SDK
2.添加依赖库
CoreTelephony.framework
libz.tbd
libsqlite3.tbd
SystemConfiguration.framework
3.在AppDelegate.m导入头文件
#import <UMPush/UMessage.h>
4.Push组件基本功能配置
UMessageRegisterEntity * entity = [[UMessageRegisterEntity alloc] init];
//type是对推送的几个参数的选择,可以选择一个或者多个。默认是三个全部打开,即:声音,弹窗,角标
entity.types = UMessageAuthorizationOptionBadge|UMessageAuthorizationOptionSound|UMessageAuthorizationOptionAlert;
[UNUserNotificationCenter currentNotificationCenter].delegate=self;
[UMessage registerForRemoteNotificationsWithLaunchOptions:launchOptions Entity:entity completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (granted) {
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"推送" message:@"推送授权成功" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alertV show];
}else{
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"推送" message:@"推送授权失败" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alertV show];
}
}];
网友评论