I Want to create a view with dynamic create checkbox i know how to create c checkbox dynamic but how to manage size of view?
Here is my Code:
var spacer: CGFloat = 23
for comments in fixer as NSArray {
var counter = ""
print(comments)
counter = comments as! String
let button = UIButton(frame:CGRect(x: 8, y: 0+spacer , width: 20, height: 20))
button.setTitle("hi", for: .normal)
self.assignfixerView.addSubview(button)
let label = UILabel(frame:CGRect(x: 40, y: 0+spacer , width: 80, height: 22))
label.text = counter
self.assignfixerView.addSubview(label)
spacer = spacer + 23
}
Here is my view :
in this user are not fix and i want status(label) and textfield position change and if i create this button than how's the selection process?
Please give me better /suggestion if any better controller than it will be ok
OR any dropdown with multiple selection and after selection all will be display in textfield
Thank You in Advanced!
Related
I have created tableview with multiple custom tableviewcell and each tableviewcell embedded with collectionview. There is one custom tableview cell with horizontal collectionview in which as per backend response download image from URL and set image in collection cell, every collection cell width and height should be change as per image size. I have implemented that using UICollectionViewCompositionalLayout method,
Step to achieve this
Get the size of image from URL.
Because image size is larger so decrease image size and set in collection cell using UICollectionViewCompositionalLayout
But when scroll tableview it is not scrolling smoothly it gets stuck for few miliseconds when this view will display in tableview. And same custom tableview cell view is used multiple times as per backend api response.
Can i achieve this layout in collectionview using UICollectionViewCompositionalLayout? Or do i have to use 'sizeForItemAt indexPath' UICollectionViewDelegateFlowLayout method for this.
I found some solutions in stackoverflow but it is for vertical collectionview but not for horizontal collectionview.
Result should be like horizontal collectionview collection cell size should be dynamic as per backend image size.
Here is below code of UICollectionViewCompositionalLayout
private func ProductCellLayout() -> UICollectionViewCompositionalLayout{
return UICollectionViewCompositionalLayout { (index: Int,_) -> NSCollectionLayoutSection in
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))
let layoutItem = NSCollectionLayoutItem(layoutSize: itemSize)
var width = 0.4
var height = 1.0
if self.viewData != nil{
if let url = URL(string: self.viewData?[index].displayImage ?? ""){
let size = self.sizeOfImageAt(url: url)
let imageWidth = size?.width ?? 1000
let imageHeight = size?.height ?? 1000
width = (imageWidth / 1000) + 0.05
height = imageHeight / 1000
}
}
let layoutGroupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(width), heightDimension: .fractionalHeight(1.0))
let layoutGroup = NSCollectionLayoutGroup.horizontal(layoutSize: layoutGroupSize, subitems: [layoutItem])
layoutGroup.contentInsets.trailing = 4
layoutGroup.contentInsets.leading = 4
let layoutSection = NSCollectionLayoutSection(group: layoutGroup)
layoutSection.orthogonalScrollingBehavior = .continuousGroupLeadingBoundary
return layoutSection
}
}
Environment: Xcode 10.2, macOS Mojave Version 10.14.5
I create an NSTextField with an attributed string like below:
let name = "Someone"
let link = "http://example.com/people/\(name)"
let attributedString = NSMutableAttributedString(string: name)
// link without underline
attributedString.addAttributes([.link : link, .underlineStyle : 0], range: NSRange(location: 0, length: name.count))
// bind UI
let label = NSTextField(frame: CGRect(x: 10, y: 10, width: 100, height: 30))
label.allowsEditingTextAttributes = true
label.isSelectable = true
label.attributedStringValue = attributedString
When the UI shows successfully, I click the link, the text area will be layout again and text shrink. Do I have missed something?
NSTextField's AttributedString Shrink
At last, I solved this problem by setting up the font of the attributed string. Code like as below works.
// link without underline
attributedString.addAttributes([.link : link,
.underlineStyle : 0,
.font: NSFont.systemFont(ofSize: 13)] // same as textField.
I am using RadDiagram in my ASP.NET application. Control doesn't offer the ability of changing font size of shapes. Is there any way to change sizes?
I create shapes dynamically. Example:
label[i] = new DiagramShape();
label[i].Y = shape[5].Y + SHAPE_HEIGHT + LABEL_TOP_MARGIN;
label[i].X = shape[i].X - LABEL_LEFT_INDENT;
label[i].Height = 20;
label[i].Width = 20;
label[i].ContentSettings.Text = dateLabels[i] ;
label[i].Background = "#FFFFFF";
label[i].ContentSettings.Color = "#000000";
RadDiagram1.ShapesCollection.Add(label[i]);
Use a template: http://docs.telerik.com/devtools/aspnet-ajax/controls/diagram/functionality/shape-templates
There are some details in getting templates to work (for starters, you will need to implement a JS function for that) and then you will need to create a text block where you can set the font:
var textBlock2 = new diagram.TextBlock({
text: options.id,
color: "#ffffff",
fontSize: 16,
x: 28,
y: 50
});
You can use server code blocks to obtain data from serer objects in the markup, or you can create the entire script on the server and register it via the ScriptManager.RegisterStartupScript(Page, Page.GetType(), "someKey", yourScriptString, true); method
I want to add description custom that's why i need textArea devexpress and this is the code can someone tell me how change this to be TextArea.
#Html.DevExpress().TextBox(f =>
{
f.Name = "Description";
f.Text = "";
f.Width = 300;
f.Height = 30;
f.Properties.NullText = "saisir description Module";
}).GetHtml()
and thank you for your help.
Please use the MVCxMemo in MVC and ASPxMemo in ASP.NET.
Memo is an editor allowing multi-line text to be displayed and edited.
#Html.DevExpress().Memo(
settings => {
settings.Name = "memo1";
settings.Text = "The editor's size can be controlled either by its Width and Height properties or, if they are not defined, by using the Columns and Rows properties.";
settings.Properties.Columns = 40;
settings.Properties.Rows = 6;
}).GetHtml()
Referenes:
MVC Extension - #Html.DevExpress().TextBox Multilines
TextArea
Implement TextArea
So i have this button:
#IBOutlet var bouton: UIBarButtonItem!
And i want to change is position
But the buton doesn't seems to have a position property like for SKSpriteNode
So is there a way to change is position ?
If you want to programmatically change the position of any view, you can use this:
button.frame.origin = CGPoint(x: 10, y: 10)
You can't set the button with myButton.frame.origin if you are using autolayout. So you must add constraints. For example:
let buttonConstraintY = NSLayoutConstraint(item: youButton, attribute: NSLayoutAttribute.centerY, relatedBy: NSLayoutRelation.equal, toItem: view, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: 10)
self.view.addConstraint(buttonConstraintY)