I got an image,which is shorter than button's width, so I want to stretch the image's both sides to fit button's width but not stretch its center because there is text in center. What should I do to achieve that? Appreciate your suggestion!
stretch image's both sides but not center for uibutton
888 Views Asked by John At
2
There are 2 best solutions below
Related Questions in IOS
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Is the transactionReceipt data present in dataWithContentsOfURL?
- UIWebView Screen Fitting Issue
- ZXingObjC encoding issues
- iOS: None of the valid provisioning profiles allowed the specific entitlements
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Slow performance on ipad erasing image
- Swift code with multiple NSDateFormatter - optimization
- iOS 8.3 Safari crashes on input type=file
- TTTTimeIntervalFormatter always returns strings in English
- How do I add multiple in app purchases in Swift Spritekit?
- Setup code for xibs in iOS. -awakFromNb:
- iOS Voice Over only reads out the title of any alert views
Related Questions in UIIMAGE
- Rotating CIImage around a point
- Swift: Display image from UIImage array in table view
- Trouble in uploading profile image to parse.com during signUpInBackgroundWithBlock
- Slight delay before image blurred
- Get name of img from for loop
- How to store PNG images for profile pictures on Parse.com?
- Allow user to change image to one from their gallery
- Swift: UIImages appearing out of order in table view
- Changing the size of the UIImage
- Loading multiple saved images in app slows it down
- Can't load image with UIImage or NSData
- iOS AVAssetWriter Video Height "Squished" when exported to from UIImages
- How to add an image when a row is selected and then remove it when it is deselected in UITableView in SWIFT
- How to add UIImage object into NSMutableArray in iOS
- WatchKit extension: how to read data from host iOS app?
Related Questions in STRETCH
- CSS Header Stretch – What am I doing wrong?
- RDLC stretch rectangle from header to footer (body height)
- Stretching bubble image in Chat app
- how to stretch layout across screen but keep content narrower?
- Equivalent Android 9-patch for iOS and Swift 3.0 (multiple stretchable areas)
- Swich background images stretching while customizing in android
- Increasing Pygame Image size after collision?
- Image Stretching in Standard HTML
- Header Stretch: (1) will not shrink to fit iphone (2) how to set max width for desktop?
- physically stretch plot in horizontal direction in python
- Stretch Image with multi region
- js stretch background image
- Make child div take max height
- (C++ ) Dealing with StretchBlt() and AlphaBlend() 's image size limitations (32768)?
- Android: vertically stretching buttons
Related Questions in UIEDGEINSETS
- Image and Text locations in UIButton
- How to remove separator gap between UITableViewCells
- iOS UIPageViewController child view under Bottom Bar
- How to change tintColor of image in UIButton with imageEdgeInsets?
- Indenting UITextLabel in custom UITableViewCell
- does setImageEdgeInsets effect setTitleEdgeInsets? why the title's left inset should be negative to let title centerd in button
- iOS 14 and Simulator UILabel extension padding bug
- UiTableview ContentInset
- Use resizableImageWithCapInsets on SKSpriteNode
- iOS 7 - UITextView clipping text
- stretch image's both sides but not center for uibutton
- How to get indexpath.row insde insetForSectionAt to give different size for different indexpath.row
- How to add edge insets to UICollectionView's contentView when using UICollectionViewCompositionalLayout of type .list
- How can I center Buttons within UICollectionViewFlowLayout for two columns? Might there be a more efficient way to solve this?
- How to keep the text of a UILabel inside the safeArea?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Look for resizableImageWithCapInsets method of UIImage.
When 10 parameter is the margin of the text inside the image.
This creates a new UIImage that you can stretch.