ios怎樣在一個UIImageButton的里面加一些自己定義的箭頭

能夠採用例如以下方法,寫一個函數:

-(UIImage*) getOneImageButtonWithArrow{//tmpView做附控件UIView *tmpView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 38.0f, 32.0f)];tmpView.backgroundColor = [UIColor clearColor];//bgImg作為背景UIImage* bgImg = [UIImage imageNamed:@"background.png"];UIImageView *bgImageView = [[UIImageView alloc] initWithImage:bgImg];bgImageView.frame = tmpView.frame;//增加tmpView[tmpView addSubview:bgImageView];[bgImageView release];//里面的iconUIImageView *tmpImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon.png"]];tmpImageView.frame = CGRectMake(4.0f, 4.0f, 24.0f, 24.0f);tmpImageView.backgroundColor = [UIColor clearColor];tmpImageView.alpha = 1.0f;[tmpView addSubview:tmpImageView];//箭頭UIImage *arrowImage = [UIImage imageNamed:@"arrow.png"];UIImageView *arrowImageView = [[UIImageView alloc] initWithImage:arrowImage];arrowImageView.frame = CGRectMake(28.0f, 4.0f, 6.0f, 24.0f);[tmpView addSubview:arrowImageView];//獲取上下文。得到這個UIImageUIGraphicsBeginImageContextWithOptions(tmpView.bounds.size, NO, 0.0);[tmpView.layer renderInContext:UIGraphicsGetCurrentContext()];UIImage *tmpImage = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();return tmpImage;
}


轉載于:https://www.cnblogs.com/ldxsuanfa/p/10621826.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/249289.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/249289.shtml
英文地址,請注明出處:http://en.pswp.cn/news/249289.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

vue從入門到精通之基礎篇(一)語法概要

(1).vue起步 1:引包2:啟動 new Vue({el:目的地,template:模板內容});options 目的地 el內容 template數據 data 保存數據屬性 數據驅動視圖 (2).插值表達式 {{ 表達式 }} 對象 (不要連續3個{{ {name:‘jack’} }})字符串 {{ ‘xxx’ }}判斷后的布爾值 {{ true }}三元表達式…

dede 文章列表頁如何倒序排列

{dede:arclist row6 typeid18 orderwayasc} <li>;<a href"[field:arcurl/]">[field:title/]</a></li> {/dede:arclist} 正常排列&#xff1a;orderwayasc倒序排列&#xff1a;orderwaydesc轉載于:https://www.cnblogs.com/php-qiuwei/p/1062…

Chapter 5 Blood Type——24

"Shes just a little faint," he reassured the startled nurse. "Theyre blood typing in Biology." "她只是有點頭暈&#xff0c;" 他讓護士放心的說道。“他們再生物課上測血型。” The nurse nodded sagely. "Theres always one."…

vue從入門到精通之基礎篇(二)組件

(1).局部組件的使用 ? 渲染組件-父使用子組件 1: 創建子組件(對象) var Header { template:模板 , data是一個函數,methods:功能,components:子組件們 } 2: 在父組件中聲明,根屬性components:{ 組件名:組件對象 }3: 在父組件要用的地方使用 <組件名></組件名> …

@Scheduled

Scheduled注解的使用這里不詳細說明&#xff0c;直接對8個參數進行講解。 參數詳解 cron 該參數接收一個cron表達式&#xff0c;cron表達式是一個字符串&#xff0c;字符串以5或6個空格隔開&#xff0c;分開共6或7個域&#xff0c;每一個域代表一個含義。 cron表達式語法 […

eclipse2019-03設置代碼編輯區背景為圖片

一、我的主題設置如下所示 二、找到如下所示或類似的文件夾 三、在該文件夾里的images文件夾里添加圖片 四、在CSS目錄下的e4-dark_win.css文件中添加如下代碼   .MPart StyledText {     background-image: url(./bg.jpg);     background-repeat: no-repeat;  …

idea集成gitlab使用ssh免密登錄

網上有很多介紹ssh免密登錄的文章&#xff0c;具體步驟如下&#xff1a; 1. 生成SSH Key ssh-keygen -t rsa -C "your_emailexample.com" 默認會在相應路徑下&#xff08;/your_home_path&#xff09;生成id_rsa和id_rsa.pub兩個文件&#xff0c;此時終端會顯示&…

vue從入門到精通之基礎篇(三)生命周期

生命周期 定義&#xff1a; 每個 Vue 實例在被創建時都要經過從創建倒掛載再到更新、卸載的一系列過程&#xff0c;同時在這個過程中也會運行一些叫做生命周期鉤子的函數&#xff0c;可以讓我們用自己注冊的js方法控制整個大局&#xff0c;在這些事件響應方法中的this直接指向…

libcurl庫進行http通訊網絡編程

https://www.cnblogs.com/lifan3a/articles/7479256.html

Java 開始

&#xff08;事先聲明&#xff1a;該文章并非完全是我自己的產出&#xff0c;更多的是我個人在看到資料后通過理解并記錄下來&#xff0c;作為自己閱讀后的一個筆記&#xff1b;我現在試圖對自己多年工作中的知識點做一個回顧&#xff0c;希望能融會貫通&#xff09; &#xff…

Java核心技術筆記——第 12 章 反射

轉載自&#xff1a;[https://www.cnblogs.com/chanshuyi/p/head_first_of_reflection.html] 12 反射 1. 引入反射 通常情況下&#xff0c;調用一個類的方法的步驟如下&#xff1a; 創建該類的對象。調用該對象的方法。通過這種方式調用方法時&#xff0c;必須要知道類的定義以及…

HTML5知識點匯總

1、HTML5新特性 用于繪畫的canvas標簽用于媒介回放的video和audio元素對本地離線儲存的更好支持新的特殊內容元素&#xff0c;如&#xff1a;article、footer、header、nav、section、aside、hgroup、figure新的表單控件&#xff0c;如&#xff1a;calendar、date、time、emai…

實用網站

https://blog.csdn.net/devcloud/article/details/103121883

網絡(圖)(數學)

轉載于:https://www.cnblogs.com/fengxunling/p/9781575.html

DES加解密時 Given final block not properly padded 的解決方案

事情的經過是這個樣子的。。。。。。 先說說問題是怎么出現的。根據客戶需求&#xff0c;需要完成一個一鍵登錄的功能&#xff0c;于是我的項目中就誕生了DesUtil&#xff0c;但是經過幾百次測試&#xff0c;發現有一個登錄直接報錯&#xff01;難道又遇到神坑啦&#xff01;&a…

java 算法優化向導

一.什么是數據結構&#xff1f;什么是算法 不必像學生時代深究定義。以一個簡單的例子說明。 數據結構&#xff0c;圖書館的書怎么擺列&#xff0c;按照書的類型&#xff0c;作者&#xff0c;出版時間&#xff0c;語言等等放置&#xff0c;這就是數據的結構。 算法&#xff0c…

appium工作原理

Appium原理 面試的時候&#xff0c;被問到appium原理&#xff0c;一點不會&#xff0c;實在尷尬。大家可以直接翻看原作https://blog.csdn.net/jffhy2017/article/details/69220719 appium運行時安裝的2個應用&#xff1a;Appium Settings和Unlock。 一、appium加載的過程圖解&…

LeetCode 21. Merge Two Sorted Lists

LeetCode 21. Merge Two Sorted Lists 分析 難度&#xff1a;易 題目 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Out…

Mac OS X 下 TAR.GZ 方式安裝 MySQL

Mac OS X 下 TAR.GZ 方式安裝 MySQL 注意: 本篇文章適用與 MySQL 5.6 版本的安裝, 但已不再適用 5.7 的安裝, 5.7 的安裝方式請參見:《Mac OS X 下 TAR.GZ 方式安裝 MySQL 5.7》 在 Mac 系統上, 安裝 MySQL Server 一般是用 DMG 包在圖形化界面下按提示安裝, 此外 MySQL 還提供…

快排再改進

快排再改進 #include <iostream> using namespace std;void mySwap(int &a, int &b) {int temp a;a b;b temp; }void insertSort(int a[], int left, int right) {int tmp;int in 0;int out 0;for (out left 1; out < right; out) {tmp a[out];in ou…