avatar
文章
204
标签
17
分类
0
首页
归档
标签
分类
关于
今是昨非的博客
首页
归档
标签
分类
关于

今是昨非的博客

iOS Widget
发表于2022-05-06
iOS Widget背景一开始是发现支付宝的 Widget 做的很好看,打算仿作一个,做的过程中才发现,原来 Widget 有这么多好玩的地方。所以,在这里记录分享一下: 你知道如何创建类似于 QQ 同步助手的 Widget 吗? 你知道类似于东方财富的不同组 Widget 效果是怎么实现的吗? 你知道下图中支付宝Widget功能是怎么实现的吗? 或者这么问,对于这几个的概念:supportedFamilies、WidgetBundle以及Configurable Widget是否知晓,如果都知道,那就不需要看本篇文章了。 QQ 同步助手的Widget只显示一个Widget的效果,是设置了 Widget 的supportedFamilies只有systemMedium 样式; 东方财富的多组 Widget,是通过WidgetBundle实现的,可以设置多个Widget,每个 Widget 都可以设置自己的大中小;区分是否使用了 WidgetBundle,可以通过滑动时,Widg...
《24点》APP——提示功能的实现
发表于2022-04-26
更新:《24点》APP——提示功能实现背景商店里所有24点 APP 的一个付费功能是提示的获取,会通过限制提示次数,超出次数后观看广告或者购买来解锁额外次数。比如: 这里就来分享一下,类似24点的提示功能是怎么实现的,其实现步骤如下: 步骤一:判断结果能不能等于24; 步骤二:如果能等于24,显示出能得到24的表达式。 下面详细记录一下实现的过程: 解法原理步骤一,判断能不能等于24有[a, b, c, d] 四个数字,任取两个数字,通过遍历运算符得到运算结果 e,然后把运算结果和剩余的数字放入新的数组中,重复上面的计算过程,直到数组中有一个元素为止;最后判断数组中唯一的数字是否等于24即可。 这里需要注意几点,一是遍历运算符的时候,加和乘符合交换律,所以不需要重复计算;二是除法会有小数,所以最终判断是否等于24的时候,需要通过设置误差范围来判断;再有就是除法的除数不能为零。 所以最终解法描述如下: 定义误差范围,定义要对比的值,定义运算符数组; 定义判断是否相等的判断方法,传入值和要对比的值的绝对值小于误差范围,即视作相等; 数据转换,由于传入的数字是Int,所以通过...
Algorithem_Matrix
发表于2022-04-24
Algorithem_Matrix题目Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1: 12Input: mat = [[0,0,0],[0,1,0],[0,0,0]]Output: [[0,0,0],[0,1,0],[0,0,0]] Example 2: 12Input: mat = [[0,0,0],[0,1,0],[1,1,1]]Output: [[0,0,0],[0,1,0],[1,2,1]] 解法
Algorithem_PermutationInString
发表于2022-04-24
Algorithem_PermutationInStringGiven two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1’s permutations is the substring of s2. Example 1: 1234Input: s1 = "ab", s2 = "eidbaooo"Output: trueExplanation: s2 contains one permutation of s1 ("ba"). Example 2: 12Input: s1 = "ab", s2 = "eidboaoo"Output: false 解法首先理解 Permutation的意思,题目需要的是 s2包含 s1中字符串的任意一种排列,就返回 true,否则返...
Algorithem_ReverseLinkedList
发表于2022-04-22
Algorithem_ReverseLinkedListGiven the head of a singly linked list, reverse the list, and return the reversed list. Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: 12Input: head = [1,2,3,4,5]Output: [5,4,3,2,1] Example 2: 12Input: head = [1,2]Output: [2,1] Example 3: 12Input: head = []Output: [] Constraints: The number of nodes in the list is the range [0, 5000].-5000 <= Node.val <= 5000 Follow up: A linked list can be reversed e...
Algorithem_MergeTwoSortedLists
发表于2022-04-22
Algorithem_MergeTwoSortedListsYou are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. Example 1: 12Input: list1 = [1,2,4], list2 = [1,3,4]Output: [1,1,2,3,4,4] Example 2: 12Input: list1 = [], list2 = []Output: [] Example 3: 12Input: list1 = [], list2 = [0]Output: [0] 解法需求是合并两个有序的LinkList,所以解法是 判断 list1.val 和 list...
Algorithem_Merge Two Binary Trees
发表于2022-04-21
Algorithem_Merge Two Binary TreesYou are given two binary trees root1 and root2. Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node. Otherwise, the NOT null node will be used as the node of the new tree. Return the merged tree. Note: The merging process must...
Algorithem_Populating Next Right Pointers in Each Node
发表于2022-04-21
Algorithem_Populating Next Right Pointers in Each NodeYou are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: 123456struct Node { int val; Node *left; Node *right; Node *next;} Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. Initially, all next pointers are set to NULL. Example 1: 12Input: root...
iOS 长截图
发表于2022-04-20
iOS长截图背景Twitter 上看到TaioApp的作者说,iOS 系统有支持长截图的API——UIScreenshotService,从 iOS 13开始就可以使用,下午的时候就在自己的 APP 中体验了一下。 过程UIScreenshotService官方的说明如下: When the user takes a screenshot of your app’s content, you work with a UIScreenshotService object to provide a PDF version of that screenshot. You do not create a UIScreenshotService object directly. Instead, you retrieve the object from the screenshotService property of your window scene and assign a delegate to it. When the user takes a screenshot, UI...
Algorithem_Max Area of Island
发表于2022-04-20
733. Algorithem_Max Area of IslandYou are given an m x n binary matrix grid. An island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. The area of an island is the number of cells with a value 1 in the island. Return the maximum area of an island in grid. If there is no island, return 0. Example 1: 123Input: grid = [[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,...
1…91011…21
avatar
今是昨非
技术分享、生活感悟
文章
204
标签
17
分类
0
Follow Me
公告
This is my Blog
最新文章
CodeBuddy Models Manager:用可视化界面管理 CodeBuddy 自定义模型2026-04-17
UnifySkillManager 一个统一的 AI 编程工具 Skill / Rule Manager2026-04-17
AI 开发的感悟2026-03-13
关于 AI 的一些很有意思的想法2026-03-06
拒绝 Stash 混乱:Git Worktree 助你开启“多线程”开发神技2026-03-06
标签
标签1 iOS iOS自动打包 iOS蓝牙 技术 随笔 ideas 标签2 Algorithem movies ReactNative 分享 books 算法 Flutter 生活 learning
归档
  • 四月 2026 2
  • 三月 2026 5
  • 二月 2026 3
  • 一月 2026 8
  • 十月 2025 1
  • 九月 2025 4
  • 八月 2025 4
  • 十二月 2024 1
网站信息
文章数目 :
204
本站访客数 :
本站总浏览量 :
最后更新时间 :
© 2026 By 今是昨非框架 Hexo 5.4.0|主题 Butterfly 5.5.3
日出江花红胜火,春来江水绿如蓝,能不忆江南