uiview

Masking UIView/UIImageView to cutout transparent text

笑着哭i 提交于 2020-01-20 04:56:47
问题 How can I mask an UIView or UIImageView so that a text is cutout from it? I googled a lot and it seems that many people struggled the same. Most irritating I always tried to invert the alpha of a snapshotted view to get the result. What I want looks like this: 回答1: This is the custom mask label. import UIKit final class MaskLabel: UILabel { // MARK: - IBInspectoable @IBInspectable var cornerRadius: CGFloat { get { return self.layer.cornerRadius } set { self.layer.cornerRadius = newValue } }

How to fill background image of an UIView

会有一股神秘感。 提交于 2020-01-18 04:46:46
问题 I have an UIView and I set a background image in this way: self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"sfond-appz.png"]]; My problem is that back-image is not centered inside the view, but it's replayed some times to fill all the view. Is there a way to center image inside uiview and scretch to have screen size? Note: I can't use UIImageView for background cause I have a scrollview . 回答1: You need to process the image beforehand, to make a centered and

Member reference base type 'Class' is not a structure or union - has the Fixit led me in the right direction?

心已入冬 提交于 2020-01-17 08:30:11
问题 I’m trying to make a delegate that will send messages from UIButtons within a custom UIView called SGView and am a bit out of my depth following the error messages. I recently learned how to get a delegate to send messages successfully from within an instance method. SGView includes a class method that arranges multiple UIButtons in a circle and was designed to be used by different UIViews. The geometry works when the method is called from a parent UIView. I have now declared the delegate by

UIView elements relevant to subclass of UIView are showing up outside of their container

两盒软妹~` 提交于 2020-01-17 06:28:48
问题 I am simply trying to add two UIButton s and a UILabel to a subclass of UIView that I made. Here is that subclass: InvitedView.m #import "InvitedView.h" #import "AppDelegate.h" @class ViewController; @interface InvitedView() { UIButton *accept; UIButton *decline; UILabel *question; UIView *gray; ViewController *myViewController; NSString *holduser; } @end @implementation InvitedView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { gray = [[UIView alloc]

UIView elements relevant to subclass of UIView are showing up outside of their container

拈花ヽ惹草 提交于 2020-01-17 06:28:09
问题 I am simply trying to add two UIButton s and a UILabel to a subclass of UIView that I made. Here is that subclass: InvitedView.m #import "InvitedView.h" #import "AppDelegate.h" @class ViewController; @interface InvitedView() { UIButton *accept; UIButton *decline; UILabel *question; UIView *gray; ViewController *myViewController; NSString *holduser; } @end @implementation InvitedView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { gray = [[UIView alloc]

Could not cast value of type 'UIView' (0x1102beb40) to 'SKView' (0x10f0814c8)

只愿长相守 提交于 2020-01-17 05:19:14
问题 Im trying to programmatically switch from a UITableView to a SKView (Can't use the storyboard to place buttons on a TableView). This is the code a have to switch views: ViewController.swift : func game() { let game = GameViewController() present(game, animated: true, completion: nil) } GameViewController.swift : import UIKit import SpriteKit class GameViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() if let scene = GameScene(fileNamed:"GameScene") { //

UIView setDelegate:]: unrecognized selector sent to instance

本秂侑毒 提交于 2020-01-17 05:03:30
问题 I am new to IOS, and Trying to pass two values form a UIViewController to a UIView. I followed few examples,some posts, tried and still no luck. I am getting this error while running the application. The error is .. [MenuComponent setDelegate:]: unrecognized selector sent to instance MenuComent is My UIView. FullVC is my UIViewController. FullVC.h @class FullVC; @protocol MenuComponentDelegate <NSObject> -(void)shareToView:(NSString *)titleString inUrl:(NSString *)urlString; @end @interface

UIView class properties seemingly disappear when I call drawRect:

好久不见. 提交于 2020-01-17 04:44:05
问题 I am coding an objective-c project with xcode. I have two important files that are being used: a viewcontroller, and a view. My view is class "PlayingCardView", my viewcontroller is class: "PlayingCardGameViewController". Here is what PlayingCardView.h looks like: #import <UIKit/UIKit.h> @interface PlayingCardView : UIView @property (nonatomic) NSUInteger rank; @property (strong, nonatomic) NSString *suit; @property (nonatomic) BOOL faceUp; @end Here is the important code from PlayingCardView

How to add a UITableView as a subview to a UIView in xib?

可紊 提交于 2020-01-17 04:15:27
问题 I have a custom view that I built using xib file. In this custom view, there is a UIView where I would like to add a static UITableView as a subview. The UITableView to be shown here is present on the storyboard and associated to a UITableViewController . I did the following: let vc = (UIStoryboard(name: "Main", bundle: nil)) .instantiateViewControllerWithIdentifier("tableController") as! TableController vc.loadViewIfNeeded() table = vc.table // this is an outlet, I'm sure it is not nil table

How to add a UITableView as a subview to a UIView in xib?

空扰寡人 提交于 2020-01-17 04:15:14
问题 I have a custom view that I built using xib file. In this custom view, there is a UIView where I would like to add a static UITableView as a subview. The UITableView to be shown here is present on the storyboard and associated to a UITableViewController . I did the following: let vc = (UIStoryboard(name: "Main", bundle: nil)) .instantiateViewControllerWithIdentifier("tableController") as! TableController vc.loadViewIfNeeded() table = vc.table // this is an outlet, I'm sure it is not nil table