В случае, если кто-то ищет версию Swift (на основе ответа @WarrenBurtons).
AppDelegate
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var window: NSWindow?
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
window = NSWindow(contentViewController: RootViewController())
window?.makeKeyAndOrderFront(self)
}
}
class RootViewController: NSViewController {
override func loadView() {
self.view = NSView()
self.view.frame = NSRect(x: 0, y: 0, width: 600, height: 400)
}
}
Подкласс NSApplication
import Cocoa
class Application: NSApplication {
let strongDelegate = AppDelegate()
override init() {
super.init()
self.delegate = strongDelegate
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Запись Info.plist
...
NSPrincipalClass
$(PRODUCT_MODULE_NAME).Application
...
Я также создал для этого смысл, чтобы я был в курсе новых версий Xcode / Swift. https://gist.github.com/florieger/7ac5e7155f6faf18666f92f7d82f6cbc
Изменить: обязательно удалите Main.storyboard / MainMenu.xib, в противном случае вы можете оказаться в двух Windows в отладчике пользовательского интерфейса.
Для статического текста используйте
android: text = "Рамеш Сингха"
blockquote>вместо
[ 115] tools: text = "Ramesh Singha"blockquote>
Для динамического текста используйте
.xml Файл
blockquote><TextView android:id="@+id/tv_boss_profile_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="#6c7383" android:letterSpacing="0.02" android:layout_below="@id/tv_emp_name" tools:hint="Field Manager" android:fontFamily="@font/roboto_slab_regular" android:layout_centerInParent="true" android:layout_marginTop="10dp" android:layout_marginBottom="10dp"/>
.Java файл
blockquote>TextView employeeName=(TextView)findViewById(R.id.tv_emp_name); employeeName.setText("Ramesh Singha");
Вы используете tools:text="Ramesh Singha"
в textView
, и это используется для целей тестирования. Вы должны использовать следующие опции, если хотите установить текст
android:text="Ramesh Singha"
Добавить код
<TextView
android:id="@+id/tv_emp_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:textColor="#262d3d"
android:letterSpacing="0.02"
tools:text="Ramesh Singha"
android:fontFamily="@font/roboto_slab_bold"
android:layout_below="@id/imgv_boss"
android:layout_centerInParent="true"
android:layout_marginTop="26dp" />
TextView userName=(TextView)findViewById(R.id.tv_emp_name)
userName.setText("Ramesh Singha")