Home>
I want to know what happens and how to make two buttons and labels that don't cause an error.
Hello, Mac on the official website – Tutorial
(Https://docs.microsoft.com/en-us/xamarin/mac/get-started/hello-mac)
When I tried to generate two buttons and labels in the same way, an error occurred.
The code where the error occurred was fixed once, but after the build, it was corrected to the code before the correction.
I don't understand why this happens, so please explain.
How can I generate multiple buttons in Xcode to prevent this error from occurring?
Professor
/Users/xxxxxxx/Desktop/DevelopMacAPP/Hello_Mac/Hello_Mac/ViewController.designer.cs (22,22): Error CS0102: The type 'ViewController' already contains a definition for 'ClickedLabel' (CS0102) ( Hello_Mac)
Location of the problem/code i am experiencing
// WARNING
//
// This file has been generated automatically by Visual Studio to store outlets and
// actions made in the UI designer.If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
using System.CodeDom.Compiler;
namespace Hello_Mac
{
[Register ("ViewController")]
partial class ViewController
{
[Outlet]
AppKit.NSButton ClickedLabel {get;set;}
[Outlet]
AppKit.NSTextField ClickLabel {get;set;}
[Action ("ClickButton:")]
partial void ClickButton (Foundation.NSObject sender);
[Action ("ClickedLabel:")]
partial void ClickedLabel (Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
// error here
if (ClickedLabel! = null) {
ClickedLabel.Dispose ();
ClickedLabel = null;
}
if (ClickLabel! = null) {
ClickLabel.Dispose ();
ClickLabel = null;
}
}
}
}
ViewController.h source code
// WARNING
// This file has been generated automatically by Visual Studio to
// mirror C # types. Changes in this file made by drag-connecting
// from the UI designer will be synchronized back to C #, but
// more complex manual changes may not transfer correctly.
#import<Foundation/Foundation.h>
#import
@interface ViewController: NSViewController {
NSButton * _ClickedLabel;
NSTextField * _ClickLabel;
}
@property (nonatomic, retain) IBOutlet NSButton * ClickedLabel;
@property (nonatomic, retain) IBOutlet NSTextField * ClickLabel;
-(IBAction) ClickButton: (id) sender;
-(IBAction) ClickedLabel: (id) sender;
@end
-
Answer # 1
Related articles
- c # - how to create csv data with different types for each row
- c # - i want to create an older version of an android app with xamarinforms, but i get a build error
- ruby - i want to create multiple radio buttons in form_tag with rails
- c # - i want to create a panel dynamically and write the process when the panel is clicked
- i want to create individual buttons with javascript
- c # - i want to create a hover action using a gradient in wpf
- c # - i want to create a xamarin login screen
- c # - i would like to create a coroutine that runs in a fixed frame even when the time scale of unity is set to 0
- i want to create a function to shuffle the contents of list with unity c #
- c # - if you create a button that transitions to the scene, make it prefab, and inherit it in each scene, 2 out of 4 will not wo
- c # - i want to create a player respawn process using "setactive"
- c # - i want to create an npc that tracks multiple players by switching targets
- vba - command buttons and labels will be created on the user's homepage
- c # - [unity 2d] i want to create a gimmick that clings to a rope, hangs, swings like a pendulum, and jumps
- c # - i want to implement a function that "disables buttons during a conversation"
- i want to create a program that outputs an excel file in c # and prints it
- c # - i want to create a collision detection so that the game is over when it hits the picturebox
- c # - i want to create software that manages products on ec sites with macros
- c # - i want to create a prefabricated car (car waypoint based) that runs automatically in unity!
- i want to create something like a uuid that is unique for each terminal in c #
Related questions
- c # - how to create a calculator ui with visualstudio for mac xamarin forms
- c # - can't build with xcode
- how to bind an image source using c # code in xamarin?
- c # - pdf displayed in xamarinforms webview disappears
- c # - i have a question about setting up opengl processing for ios in xamarin
- c # - how to put an input control inside a xamarin + prism dialog box
- c # - i want to create an older version of an android app with xamarinforms, but i get a build error
- macos (osx) - code is not automatically generated when adding a view controller in xamarinmac
ClickedLabel
is the name. Please make either one a different name.When changing, change ViewController.h.
If you change the name, you will also need to reconfigure the connection to the ViewController. (It ’s a circle with an arrow button.)