# 21.Cycrupt用法

## 一、动态调试

![1](/files/-MaNQBPaXZdN-jEsifxp)

这里我通过Cycript修改了微信语言选择按钮的文案。

### 1.1 choose

```cpp
cy# choose(UILabel)
[#"<UIButtonLabel: 0x111f48ca0; frame = (70 12.6667; 37 22); text = '\xe7\x99\xbb\xe5\xbd\x95'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x280c9b700>>",#"<UIButtonLabel: 0x111f674f0; frame = (70 12.6667; 37 22); text = '\xe6\xb3\xa8\xe5\x86\x8c'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x280c8a530>>",#"<UIButtonLabel: 0x111f78250; frame = (15 16; 58 17); text = '\xe7\xae\x80\xe4\xbd\x93\xe4\xb8\xad\xe6\x96\x87'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x280c8aa30>>",#"<MMUILabel: 0x111f89350; baseClass = UILabel; frame = (0 0; 0 36); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x280cf1ef0>>",#"<MMUILabel: 0x111f8c750; baseClass = UILabel; frame = (0 0; 0 36); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x280cf2ad0>>",#"<UILabel: 0x111f8e430; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x280cf3890>>",#"<UILabel: 0x111c36770; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x280cc9720>>"]
```

### 1.2 设置值

```cpp
cy# #0x111f78250.text = @"Ryukie"
@"Ryukie"
```

## 二、高级用法

### 2.1 cy封装

#### APPID

```cpp
cy# APPID
@"cn.Ryukie.Sama.Hanoi"
```

#### pvcs

```cpp
cy# pvcs()
"<MMUINavigationController 0x1120d5a00>, state: appeared, view: <UILayoutContainerView 0x111c0e060>\n   | <WCAccountLoginFirstViewController 0x11292d400>, state: appeared, view: <UIView 0x111c1c680>"
```

> 这些其实都是封装好的一些.cy文件。再拷贝进包中。

### 2.2 自定义cy

```cpp
➜  Cy touch Ryukie.cy
➜  Cy vim Ryukie.cy
➜  Cy cat Ryukie.cy
sum = function(a,b) {
    return a + b;
}
```

#### a. 添加到工程中

![2](/files/-MaNQBPbtYvvQXvlO1b8)

#### b. 添加Copy

![3](/files/-MaNQBPcr8gRo0znpXDU)

#### c. 运行工程，链接cy

```cpp
➜  Cy sh cyWifiLogin.sh // 这里是封装了链接的脚本
cy# @import Ryukie
{}
cy# sum(1,3)
4
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ryukiedev.gitbook.io/wiki/ni-xiang/21.cycrupt-yong-fa.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
