UIImage *image = [UIImage imageNamed:@"qq"];
第一种:
// 左端盖宽度 NSInteger leftCapWidth = image.size.width * 0.5f; // 顶端盖高度 NSInteger topCapHeight = image.size.height * 0.5f; // 重新赋值 image = [image stretchableImageWithLeftCapWidth:leftCapWidth topCapHeight:topCapHeight];
JSQm+CFOnSayiCdLARkkBCiSEQVMTO4gquBRERsCErIgquBZC1IBYsLIK9L8iioj4XdbGh8r7Akt3z3tv/3j1nZn65c+fOnfnunHMDQD/JlUgyURWALHGuNCrIl52QmMQm/QoI4IECKDhweTkSn8jIMPhHeX8bs8bkhrXc1z+a/e8JVb4ghweARGLTKfwcXhbGx7BWy5NIcwFwCZjeaFGuRM4FGKtLsQAx3iTntAmulXPKBLeO28RE+WE2XQBkOpcrTQOg3cX07DxeGuaH9hFjWzFfJAagm2PsyRNy+RgLMZ6WlbVQzmUYm6f8zU/a35jLTVH45HLTFDxxFmwltrG/KEeSyV0y/uP/2WVlyrD7GhcDrKcLpcFR2EjG7qw6Y2GogsUpsyIm9SLsRJMslAXHTjIvxw+7y4m1fK5/6CTLMmJ9JpkrxehPG1EuJ2aSpQujFP7FmbPk+TEeg1DAUbAgJyB6Up8qCuRMcr4wJn6S80RxsyY5JyNaEUO+0E+hl8qiFDGnSgMVZ8zKwVb+uS+P+9deucKY4Ek9X+AfMMkCcawiHkmur8KPJHM8v8fjF2QGKfQ5edGKtbnSGIU+nRsiz9dxe0lupOJOQAThwAVermAxlmcAfgslS6SiNGEu2wd7GQI2R8yzmca2t7VzBJC/M7kNwDvW+PtBWFf+0mW3A7gWY99UnuJsuRUA1wjgxFMA5vu/dEZvsRTA3sKpHp5Mmjdhh5cPBKCCMqiDFuiBEZiDNdiDE7iDNwRACERADCTCfOCBELJACougAFZBEZTAJtgKlbAL9sJ+OARHoAVOwlm4CFehB27BA+iDQXgJw/AeRhEEISEMhIloIfqICWKF2CMuiCcSgIQhUUgikoykIWJEhhQga5ASpBSpRPYg9chPyAnkLHIZ6UXuIf3IEPIW+YziU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8MuPiTw+hk7tQ/gcvZpum4mGlbrxtAHXvTgWU1s5ob9EoMcJuJJsvJoH7e+QHz7Bmb0XzrQfN//Fe/urFd4rczvAnvzK4dEXiAARCJ4A6TZ4xhQDEfCbAOnWb6IUHhEIngDpNnjGFAMR8JsA6dZvohQeEQieAOk2eMYUAxHwmwDp1m+iFB4RCJ4A6TZ4xhQDEfCbAOnWb6IUHhEIngDpNnjGFAMR8JsA6dZvohQeEQieAOk2eMYUAxHwm8D/A71YxGq8GZ2PAAAAAElFTkSuQmCC" alt="" />
第二种:
CGFloat top = 25; // 顶端盖高度 CGFloat bottom = 25 ; // 底端盖高度 CGFloat left = 10; // 左端盖宽度 CGFloat right = 10; // 右端盖宽度 UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right); // 指定为拉伸模式,伸缩后重新赋值 image = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
JEEiO5n18Sd+KPlPNLVqE9K1+mro2d+YriLDwaJMsQTQ6I/5Eop6AZKA2ktV4mfoxuWtiuh6nTDQtT1xZwkK5VAdvV2OnPNn9YTISeJIG0KSMIJKvU4jCRpcwqmNJCWb6iNXKfJiiMxarCNg8WQiAkKW2IKyklf4bQIUOrUCpzM6eSjNwjXmtQYMtJAWqyC+KwFcfz4TZPMYP+TO7LmB5woCI5lXplTX8XT1vmpPx6ZihMyXT6MJtdoybhEqXGQSgNpTcYJRqYisZAMt4GGDF03FiX9Go6KBANMfQXUFzg9AkhaOuTXHOk4iDNZxoEk4BZbFJ5S095zO62kpUgYtIokunMFh8zgsBS/Uzp1mBeKHjYntGKNtTt9VU/PGVihZDQz32HApLmCe3s1L4mmtps/vG6Q5xHXCzpvpzRufmpIC0tpk9A+pQAQp/TFofdicLq+lIe3iFNsTmLol8NY6KQIdBCgPlBnmM3gDzlyHmCXegJ73zSe7TSDSAb7my4DVdJJCwHpwkFsEqSOMxM9b0TVQVdEKyy1425YjipXlaaDELB1g+SsJCqxvnFUIWTvi70mmVkZ34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iYUv65e1Z0gwOOX7gPsxQ9zZmRp4/5NK6SxFQBMZHwEhK92/ulD5azkna9MHTQNIiYOcLzt/dnft0rYjX3uAr6B5FQBE4BwTIZPbVjZm//bQkoZRDrzeQtJxFl8+NpdxvfjFPYKo37MChd9CdioAiMAoBAlQ+W8v/81cLq3OSumH4NIKLkPXe+sxvfrF4fUmNUsOR1L2KwBkRILCM8eL+9a+vMJzfcMXY3iBrwyeG3A0HW6LDvntZ/+23B2R2JxpDnUeHwKW7FIHxEaARis0Jufgvf7V491qeHtpRUlauPZq0HARLiT+GsV8/qn7ztErAsURNaVjG+IWjRyoCxxAQZmYzOC8tzHjYen/9+TxjXtPPOg5j5dSRktbeC94Siwxd//yi9p8/VMlGKYHaZkxBCCzRj73AbsNnlcbHykhXLy8CEJHwYlqhrNhIY0kb4GRQie+s5X/1Senz9SKexqdyGR6XtB3qSoY7clLGJD2R4Z4ljZj8JMmASbAgORZIq0UKAnILGPJK8Cgy2XK4K5yV0Ze3EqfyzQ0xbRoAmxHArJsMATYjiknl4TICxmyuk4uLUU5ur+Tmi974ArYH3elI26GuzdZpckGQaYEMA+R2kWxjgeRDYSaLD6SVlRbstVlCJFeDHBBEZCcwn5/eM+iKIjCdCIj0EZVWEuh1s+HlZGh5k66I8RnJW0QyUE9SgpKuSHJr+Q6+wZIB0+TuGVchfhees5D23SvoL0VAEfigCIzo8vmgz6I3UwQUgTEQUNKOAZIeoggkCQElbZJKQ59FERgDASXtGCDpIYpAkhBQ0iapNPRZFIExEFDSjgGSHqIIJAkBJW2SSkOfRREYAwEl7Rgg6SGKQJIQ+H9LKAWkYESzdwAAAABJRU5ErkJggg==" alt="" />
补:UIButton加载图片:
[button setBackgroundImage:image forState:UIControlStateNormal];
原图:SSOikCKht8+hhY3ZCom/UVJtBvd1r2Oi3sKUXAbXdQldpQAyszt/mIRY0kAs6edQW3FBN/o7PdcyKM8kU+Rfb00dNpay2kVkNtQKgAj9G4qmbw5ECE6NNRh41WLMuxoznGojA+0M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