- Swift4.0: 利用图形上下文画基础图?
Dayu大鱼
步骤:开启图片上下文获取上下文配置上下文3.1填充颜色cgColor3.2填充尺寸从图形上下文中获取图片关闭上下文返回图片importFoundationimportUIKitextensionUIImage{///画一个白色背景的图片classfuncimageWithWhiteBackGroundColor()->UIImage{//开始图形上下文UIGraphicsBeginImageCon
- 获取image信息
布丶Ding
NSData*data=UIImageJPEGRepresentation(image,1.0);CGImageSourceRefref=CGImageSourceCreateWithData((__bridgeCFDataRef)data,NULL);CFDictionaryRefdicRef=CGImageSourceCopyPropertiesAtIndex(ref,0,NULL);NSDi
- 2018-01-16判断相机
super_2e20
pragmamark-摄像头和相册相关的公共类//判断设备是否有摄像头-(BOOL)isCameraAvailable{return[UIImagePickerControllerisSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];}//前面的摄像头是否可用-(BOOL)isFrontCameraAvailable{retu
- iOS 图片添加模糊效果
海边的遐想
iOS.图片模糊效果的两种实现方法://1,vImage_Buffer可以调整模糊度pragmamark-----图片添加模糊效果----------------+(UIImage*)blurryImage:(UIImage*)imagewithBlurLevel:(CGFloat)blur{if(blur1.f){blur=0.5f;}intboxSize=(int)(blur*40);boxS
- 图片倒影
child_cool
A87C5877-1A82-4ED8-A48C-382C39708A6A.png方法一将图片添加到两个相同的layer上对要倒影的结果layer进行180度旋转使用渐变图层进行颜色处理letballoon=UIImage(named:"1.jpeg")lettopLayer=CALayer()topLayer.bounds=CGRect(x:0.0,y:0.0,width:balloon?.siz
- ios 图片加载内存尺寸_iOS图片内存优化
weixin_39606244
ios图片加载内存尺寸
基于现在iOS11新生成的图片都是HEIF,该图片使用UIImage(named:name)已不在那么优雅,图片大小为1.8m大小的,读进手机内存,直接飙升了45M,这是我们不想看到的结果,一个页面有多个这样子的图的话,恐怕就是灾难了。既然原图不能读入,那么如何可以用更少的内存和CPU来解决呢?这就要先了解该图片的编码了。HEICHEIF带有元数据的HEIF的另一种形式。HEIC文件包含一个或多个
- 某项目 需要在UITabbar 上显示小红点,在此搜罗了三个方法。
小蜗牛爬楼梯
1.使用系统自带的,并且可以在小红点上显示数字。[itemOnesetBadgeValue:@""];//显示不带数字的小红点[itemOnesetBadgeValue:@"1"];//显示小红点并且带数字以上的缺点:小红点太大了,伤不起啊!2.使用图片,创建图片的时候,设置图片的渲染。UIImage*normalImage=[[UIImageimageNamed:@"pic_msg_yes_no
- iOS 改变左右侧距离
王家小雷
(void)initNavBar{UIButton*addBtn=[[UIButtonalloc]initWithFrame:CGRectMake(0,0,24,24)];[addBtnsetImage:[UIImageimageNamed:@"NewBack"]forState:UIControlStateNormal];[addBtnsetContentHorizontalAlignment:
- Alamofire 上传图片
闲鱼尼克
letaddress=Service().avatarUrlString()letheaders=["authorization":"111111"]letimgData=UIImageJPEGRepresentation(uploadImage,0.2)!letURL=try!URLRequest(url:address,method:.post,headers:headers)Alamofir
- iOS 使用Image I/O 实现超大图片降采样
刘小哈哈哈
ios
一个图片解码成未压缩的位图的时候,占用的内存和图片的文件大小没有关系,和图片的尺寸大小有关系,尺寸越大,所需要的像素点越多,所以超大图片,我们需要进行优化处理这里直接上降采样代码给UIImage添加一个分类,在分类中添加一个方法,该size就是UIImageView的大小-(UIImage*)resizeCG:(CGSize)size{CGFloatmaxPixelSize=MAX(size.wi
- 图片解压缩
嘿丶花姑娘
(UIImage*)decompressedImageWithData:(NSData*)data{CGImageSourceRefsource=CGImageSourceCreateWithData((__bridgeCFDataRef)data,NULL);CGImageRefcgImage=CGImageSourceCreateImageAtIndex(source,0,(__bridgeC
- UICollectionView使用
搬砖行家
首先我们自定义一个UICollectionViewCell,和自定义UITableViewCell差不多,只是这里定义的是一个网格。-(id)initWithFrame:(CGRect)frame{self=[superinitWithFrame:frame];if(self){//设置CollectionViewCell中的图像框self.imageView=[[UIImageViewalloc
- (IOS)删除UISearchBar系统默认边框
rightmost
//方法一searchBar.searchBarStyle=UISearchBarStyleMinimal;//方法二[searchBarsetBackgroundImage:[[UIImagealloc]init]];//方法三searchBar.barTintColor=[UIColorwhiteColor];
- IOS的图片处理
X_code_ZH
1、定制图片大小,将图片定制为kAppIconSize宽高,用于图片的页面适应缩放UIImage*image=[[UIImagealloc]initWithData:data];if(image.size.width!=kAppIconSize||image.size.height!=kAppIconSize){CGSizeitemSize=CGSizeMake(kAppIconSize,kApp
- iOS高效图片压缩:HEIC图像压缩
DearDan_f92e
前言:HEIF(即高效图像文件格式)是一种新的图像文件格式,在许多方面都比其JPEG更好。该格式由MPEG在2013年开发,声称保存的数据量是JPEG的两倍,并且支持多种类型的图像数据。extensionUIImage{enumHEICError:Error{caseheicNotSupportedcasecgImageMissingcasecouldNotFinalize}//接口iOS4+。其
- 使用OpenCV处理图片的亮度、对比度、曝光、高光、阴影、饱和度、色温,色相(附源码)
奔跑的蚂蚁01
iOSopencv人工智能计算机视觉
屏幕录制2023-05-2222.09.32集成opencv的方式请参照上一个帖子OpenCV在iOS端的集成及Mat和UIImage互相转化(附源码)废话不多说直接上代码,伸手党福利:代码中记得引入头文件及命名空间#import#import"CVTools.h"//对应的.h文件命名空间在自己的.h文件后定义usingnamespacecv;usingnamespacestd;下面的处理方法统
- UIImage转PixelBuffer
陆号
extensionUIImage{publicfuncpixelBuffer(width:Int,height:Int)->CVPixelBuffer?{varmaybePixelBuffer:CVPixelBuffer?letattrs=[kCVPixelBufferCGImageCompatibilityKey:kCFBooleanTrue,kCVPixelBufferCGBitmapCont
- iOS面试题:SDWebImage原理
IOS应用
SDWebImage一个为UIImageView提供一个分类来支持远程服务器图片加载的库。功能简介:1、一个添加了web图片加载和缓存管理的UIImageView分类2、一个异步图片下载器3、一个异步的内存加磁盘综合存储图片并且自动处理过期图片4、支持动态gif图5、支持webP格式的图片6、后台图片解压处理7、确保同样的图片url不会下载多次8、确保伪造的图片url不会重复尝试下载9、确保主线程
- iOS13去掉tabBar黑线(Swift版)
ShineYangGod
iOS13之前,去掉黑线:设置UITarBar的backgroundImage和shadowImage即可:self.tabBar.backgroundImage=UIImage.init()self.tabBar.shadowImage=UIImage.init()iOS13之后不好使了,改用下面的方法:if#available(iOS13,*){letappearance=tabBar.sta
- Swift ImageView 加载SVG图片
冯汉栩
Swift基础swift开发语言ios
一直觉得自己写的不是技术,而是情怀,一个个的教程是自己这一路走来的痕迹。靠专业技能的成功是最具可复制性的,希望我的这条路能让你们少走弯路,希望我能帮你们抹去知识的蒙尘,希望我能帮你们理清知识的脉络,希望未来技术之巅上有你们也有我。前言在网上有网友总结过一遍写得不错的文章:iOS端矢量图解决方案汇总(SVG篇)正题添加SVG图片按键加载SVG图片button.setImage(UIImage(nam
- ios 获取视频中的某一帧图片
飞行的理想
/**获取视频的某一帧@paramcurrentTime某一时刻单位s@parampath视频路径@returnreturn返回image*/+(UIImage*)getVideoImageWithTime:(Float64)currentTimevideoPath:(NSURL*)path{AVURLAsset*asset=[[AVURLAssetalloc]initWithURL:pathop
- object-c一些基础内容--简单整理版
小白不想秃头
c语言ios开发语言objective
#import@interfaceViewController()@property(strong,nonatomic)UIImageView*imageView;@property(strong,nonatomic)UIButton*cameraButton;@end@implementationViewController-(void)viewDidLoad{[superviewDidLoad
- IOS 根据显示的空间尺寸来压缩显示图片尺寸
贼噶人
//按照显示控件的size来设置重新加载图片的尺寸funccompresImage(srcImage:UIImage,size:CGSize)->UIImage{ifsize.width>=srcImage.size.width&&size.height>=srcImage.size.height{returnsrcImage}varnewSize=CGSize.init()ifsrcImage.
- (IOS)获得灰度图
rightmost
+(UIImage*)covertToGrayImageFromImage:(UIImage*)sourceImage{intwidth=sourceImage.size.width;intheight=sourceImage.size.height;CGColorSpaceRefcolorSpace=CGColorSpaceCreateDeviceGray();CGContextRefconte
- iOS开发技巧-UIImageView 的contentMode属性说明和使用
Pandakingli
contentMode这个属性是用来设置图片的显示方式,如居中、居右,是否缩放等。苹果api里面的说明typedefNS_ENUM(NSInteger,UIViewContentMode){UIViewContentModeScaleToFill,UIViewContentModeScaleAspectFit,//contentsscaledtofitwithfixedaspect.remaind
- UIImage 图片处理:截图,缩放,设定大小,存储
S大偉
图片的处理大概分截图(capture),缩放(scale),设定大小(resize),存储(save)1.等比率缩放-(UIImage*)scaleImage:(UIImage*)imagetoScale:(float)scaleSize{UIGraphicsBeginImageContext(CGSizeMake(image.size.width*scaleSize,image.size.hei
- iOS UIButton 点击无响应的解决办法
CoderLGL
按钮不响应的原因按钮添加到了一个没有开启用户交互的父View上,例如UIImageView,这时候开启父试图的交互view.userInteractionEnabled=YES设为YES就可以解决问题按钮自身被遮挡,点击的时候根本就没有点击到button,而是他上面一层View,自然就不会响应,使用xcode看图层的方法,可以清晰看出.按钮的frame超出了父视图的frame,这个是最容易出现的,
- iOS改变UIBarButtonItem的大小
雪山飞狐_91ae
我们在写代码自定义UIBarButtonItem的时候,一般是像下面这样来定义的:self.navigationItem.rightBarButtonItem=[[UIBarButtonItemalloc]initWithImage:[UIImageimageNamed:@"qr-code"]style:UIBarButtonItemStylePlaintarget:selfaction:nil]
- iOS-圆角的另外两种实现方式
良人不归_墨染锦年
-(void)ImageV1{UIImageView*imageView=[[UIImageViewalloc]initWithFrame:CGRectMake(200,200,200,200)];imageView.image=[UIImageimageNamed:@"1"];UIBezierPath*maskPath=[UIBezierPathbezierPathWithRoundedRect
- swift BUtton调整左右subView的间距
LiYaoPeng
extensionUIButton{funcsetSubViewPosition(imageanImage:UIImage?=nil,title:String?=nil,titlePosition:UIViewContentMode,additionalSpacing:CGFloat,state:UIControlState){self.imageView?.contentMode=.center
- java线程的无限循环和退出
3213213333332132
java
最近想写一个游戏,然后碰到有关线程的问题,网上查了好多资料都没满足。
突然想起了前段时间看的有关线程的视频,于是信手拈来写了一个线程的代码片段。
希望帮助刚学java线程的童鞋
package thread;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date
- tomcat 容器
BlueSkator
tomcatWebservlet
Tomcat的组成部分 1、server
A Server element represents the entire Catalina servlet container. (Singleton) 2、service
service包括多个connector以及一个engine,其职责为处理由connector获得的客户请求。
3、connector
一个connector
- php递归,静态变量,匿名函数使用
dcj3sjt126com
PHP递归函数匿名函数静态变量引用传参
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Current To-Do List</title>
</head>
<body>
- 属性颜色字体变化
周华华
JavaScript
function changSize(className){
var diva=byId("fot")
diva.className=className;
}
</script>
<style type="text/css">
.max{
background: #900;
color:#039;
- 将properties内容放置到map中
g21121
properties
代码比较简单:
private static Map<Object, Object> map;
private static Properties p;
static {
//读取properties文件
InputStream is = XXX.class.getClassLoader().getResourceAsStream("xxx.properti
- [简单]拼接字符串
53873039oycg
字符串
工作中遇到需要从Map里面取值拼接字符串的情况,自己写了个,不是很好,欢迎提出更优雅的写法,代码如下:
import java.util.HashMap;
import java.uti
- Struts2学习
云端月影
最近开始关注struts2的新特性,从这个版本开始,Struts开始使用convention-plugin代替codebehind-plugin来实现struts的零配置。
配置文件精简了,的确是简便了开发过程,但是,我们熟悉的配置突然disappear了,真是一下很不适应。跟着潮流走吧,看看该怎样来搞定convention-plugin。
使用Convention插件,你需要将其JAR文件放
- Java新手入门的30个基本概念二
aijuans
java新手java 入门
基本概念: 1.OOP中唯一关系的是对象的接口是什么,就像计算机的销售商她不管电源内部结构是怎样的,他只关系能否给你提供电就行了,也就是只要知道can or not而不是how and why.所有的程序是由一定的属性和行为对象组成的,不同的对象的访问通过函数调用来完成,对象间所有的交流都是通过方法调用,通过对封装对象数据,很大限度上提高复用率。 2.OOP中最重要的思想是类,类是模板是蓝图,
- jedis 简单使用
antlove
javarediscachecommandjedis
jedis.RedisOperationCollection.java
package jedis;
import org.apache.log4j.Logger;
import redis.clients.jedis.Jedis;
import java.util.List;
import java.util.Map;
import java.util.Set;
pub
- PL/SQL的函数和包体的基础
百合不是茶
PL/SQL编程函数包体显示包的具体数据包
由于明天举要上课,所以刚刚将代码敲了一遍PL/SQL的函数和包体的实现(单例模式过几天好好的总结下再发出来);以便明天能更好的学习PL/SQL的循环,今天太累了,所以早点睡觉,明天继续PL/SQL总有一天我会将你永远的记载在心里,,,
函数;
函数:PL/SQL中的函数相当于java中的方法;函数有返回值
定义函数的
--输入姓名找到该姓名的年薪
create or re
- Mockito(二)--实例篇
bijian1013
持续集成mockito单元测试
学习了基本知识后,就可以实战了,Mockito的实际使用还是比较麻烦的。因为在实际使用中,最常遇到的就是需要模拟第三方类库的行为。
比如现在有一个类FTPFileTransfer,实现了向FTP传输文件的功能。这个类中使用了a
- 精通Oracle10编程SQL(7)编写控制结构
bijian1013
oracle数据库plsql
/*
*编写控制结构
*/
--条件分支语句
--简单条件判断
DECLARE
v_sal NUMBER(6,2);
BEGIN
select sal into v_sal from emp
where lower(ename)=lower('&name');
if v_sal<2000 then
update emp set
- 【Log4j二】Log4j属性文件配置详解
bit1129
log4j
如下是一个log4j.properties的配置
log4j.rootCategory=INFO, stdout , R
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appe
- java集合排序笔记
白糖_
java
public class CollectionDemo implements Serializable,Comparable<CollectionDemo>{
private static final long serialVersionUID = -2958090810811192128L;
private int id;
private String nam
- java导致linux负载过高的定位方法
ronin47
定位java进程ID
可以使用top或ps -ef |grep java
![图片描述][1]
根据进程ID找到最消耗资源的java pid
比如第一步找到的进程ID为5431
执行
top -p 5431 -H
![图片描述][2]
打印java栈信息
$ jstack -l 5431 > 5431.log
在栈信息中定位具体问题
将消耗资源的Java PID转
- 给定能随机生成整数1到5的函数,写出能随机生成整数1到7的函数
bylijinnan
函数
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class RandNFromRand5 {
/**
题目:给定能随机生成整数1到5的函数,写出能随机生成整数1到7的函数。
解法1:
f(k) = (x0-1)*5^0+(x1-
- PL/SQL Developer保存布局
Kai_Ge
近日由于项目需要,数据库从DB2迁移到ORCAL,因此数据库连接客户端选择了PL/SQL Developer。由于软件运用不熟悉,造成了很多麻烦,最主要的就是进入后,左边列表有很多选项,自己删除了一些选项卡,布局很满意了,下次进入后又恢复了以前的布局,很是苦恼。在众多PL/SQL Developer使用技巧中找到如下这段:
&n
- [未来战士计划]超能查派[剧透,慎入]
comsci
计划
非常好看,超能查派,这部电影......为我们这些热爱人工智能的工程技术人员提供一些参考意见和思想........
虽然电影里面的人物形象不是非常的可爱....但是非常的贴近现实生活....
&nbs
- Google Map API V2
dai_lm
google map
以后如果要开发包含google map的程序就更麻烦咯
http://www.cnblogs.com/mengdd/archive/2013/01/01/2841390.html
找到篇不错的文章,大家可以参考一下
http://blog.sina.com.cn/s/blog_c2839d410101jahv.html
1. 创建Android工程
由于v2的key需要G
- java数据计算层的几种解决方法2
datamachine
javasql集算器
2、SQL
SQL/SP/JDBC在这里属于一类,这是老牌的数据计算层,性能和灵活性是它的优势。但随着新情况的不断出现,单纯用SQL已经难以满足需求,比如: JAVA开发规模的扩大,数据量的剧增,复杂计算问题的涌现。虽然SQL得高分的指标不多,但都是权重最高的。
成熟度:5星。最成熟的。
- Linux下Telnet的安装与运行
dcj3sjt126com
linuxtelnet
Linux下Telnet的安装与运行 linux默认是使用SSH服务的 而不安装telnet服务 如果要使用telnet 就必须先安装相应的软件包 即使安装了软件包 默认的设置telnet 服务也是不运行的 需要手工进行设置 如果是redhat9,则在第三张光盘中找到 telnet-server-0.17-25.i386.rpm
- PHP中钩子函数的实现与认识
dcj3sjt126com
PHP
假如有这么一段程序:
function fun(){
fun1();
fun2();
}
首先程序执行完fun1()之后执行fun2()然后fun()结束。
但是,假如我们想对函数做一些变化。比如说,fun是一个解析函数,我们希望后期可以提供丰富的解析函数,而究竟用哪个函数解析,我们希望在配置文件中配置。这个时候就可以发挥钩子的力量了。
我们可以在fu
- EOS中的WorkSpace密码修改
蕃薯耀
修改WorkSpace密码
EOS中BPS的WorkSpace密码修改
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
蕃薯耀 201
- SpringMVC4零配置--SpringSecurity相关配置【SpringSecurityConfig】
hanqunfeng
SpringSecurity
SpringSecurity的配置相对来说有些复杂,如果是完整的bean配置,则需要配置大量的bean,所以xml配置时使用了命名空间来简化配置,同样,spring为我们提供了一个抽象类WebSecurityConfigurerAdapter和一个注解@EnableWebMvcSecurity,达到同样减少bean配置的目的,如下:
applicationContex
- ie 9 kendo ui中ajax跨域的问题
jackyrong
AJAX跨域
这两天遇到个问题,kendo ui的datagrid,根据json去读取数据,然后前端通过kendo ui的datagrid去渲染,但很奇怪的是,在ie 10,ie 11,chrome,firefox等浏览器中,同样的程序,
浏览起来是没问题的,但把应用放到公网上的一台服务器,
却发现如下情况:
1) ie 9下,不能出现任何数据,但用IE 9浏览器浏览本机的应用,却没任何问题
- 不要让别人笑你不能成为程序员
lampcy
编程程序员
在经历六个月的编程集训之后,我刚刚完成了我的第一次一对一的编码评估。但是事情并没有如我所想的那般顺利。
说实话,我感觉我的脑细胞像被轰炸过一样。
手慢慢地离开键盘,心里很压抑。不禁默默祈祷:一切都会进展顺利的,对吧?至少有些地方我的回答应该是没有遗漏的,是不是?
难道我选择编程真的是一个巨大的错误吗——我真的永远也成不了程序员吗?
我需要一点点安慰。在自我怀疑,不安全感和脆弱等等像龙卷风一
- 马皇后的贤德
nannan408
马皇后不怕朱元璋的坏脾气,并敢理直气壮地吹耳边风。众所周知,朱元璋不喜欢女人干政,他认为“后妃虽母仪天下,然不可使干政事”,因为“宠之太过,则骄恣犯分,上下失序”,因此还特地命人纂述《女诫》,以示警诫。但马皇后是个例外。
有一次,马皇后问朱元璋道:“如今天下老百姓安居乐业了吗?”朱元璋不高兴地回答:“这不是你应该问的。”马皇后振振有词地回敬道:“陛下是天下之父,
- 选择某个属性值最大的那条记录(不仅仅包含指定属性,而是想要什么属性都可以)
Rainbow702
sqlgroup by最大值max最大的那条记录
好久好久不写SQL了,技能退化严重啊!!!
直入主题:
比如我有一张表,file_info,
它有两个属性(但实际不只,我这里只是作说明用):
file_code, file_version
同一个code可能对应多个version
现在,我想针对每一个code,取得它相关的记录中,version 值 最大的那条记录,
SQL如下:
select
*
- VBScript脚本语言
tntxia
VBScript
VBScript 是基于VB的脚本语言。主要用于Asp和Excel的编程。
VB家族语言简介
Visual Basic 6.0
源于BASIC语言。
由微软公司开发的包含协助开发环境的事
- java中枚举类型的使用
xiao1zhao2
javaenum枚举1.5新特性
枚举类型是j2se在1.5引入的新的类型,通过关键字enum来定义,常用来存储一些常量.
1.定义一个简单的枚举类型
public enum Sex {
MAN,
WOMAN
}
枚举类型本质是类,编译此段代码会生成.class文件.通过Sex.MAN来访问Sex中的成员,其返回值是Sex类型.
2.常用方法
静态的values()方